drm/panel: Use managed helpers in DSI panels
Subsystems (21)
v7 cover drm/panel: Use managed helpers in DSI panels
Hi,
This series converts straightforward DRM panel drivers to the managed MIPI DSI attach and panel add helpers, dropping the corresponding manual detach/remove calls from remove paths. Split by driver family/vendor to keep the changes reviewable.
Patches 2, 4 and 5 of v4 (Samsung, Himax/Ilitek and display vendor panels) are already in drm-misc-next and are not resent here.
v7:
- Changelog is trimmed. No code changes
from v6.
v6:
- Drop panel-simple and panel-dsi-cm: both run extra teardown after drm_panel_remove(), which devm would reorder.
- khadas-ts050, tdo-tl070wsh30: fix build break.
v5:
- nt35510: keep manual attach/detach; remove() powers off after it. (Luca)
- panel-simple: split into its own patch. (Luca)
v4:
- Use devm_drm_panel_add() instead of drm_panel_add().
Osama Abdelkader (3):
drm/panel: Use devm_mipi_dsi_attach in BOE panels drm/panel: Use managed helpers in Novatek and Raydium panels drm/panel: Use managed helpers in assorted panels
.../drm/panel/panel-asus-z00t-tm5p5-n35596.c | 20 +++-------- .../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 +++---------- .../drm/panel/panel-boe-th101mb31ig002-28a.c | 24 ++++---------- .../gpu/drm/panel/panel-boe-tv101wum-ll2.c | 23 +++---------- .../gpu/drm/panel/panel-boe-tv101wum-nl6.c | 24 ++------------ .../gpu/drm/panel/panel-chipwealth-ch13726a.c | 20 +++-------- drivers/gpu/drm/panel/panel-ebbg-ft8719.c | 20 +++-------- drivers/gpu/drm/panel/panel-elida-kd35t133.c | 20 +++-------- .../gpu/drm/panel/panel-feixin-k101-im2ba02.c | 19 +++-------- .../drm/panel/panel-feiyang-fy07024di26a30d.c | 19 +++-------- drivers/gpu/drm/panel/panel-hydis-hv101hd1.c | 24 +++----------- drivers/gpu/drm/panel/panel-innolux-p079zca.c | 33 +++---------------- .../gpu/drm/panel/panel-jadard-jd9365da-h3.c | 19 +++-------- drivers/gpu/drm/panel/panel-khadas-ts050.c | 23 +++---------- .../drm/panel/panel-kingdisplay-kd097d04.c | 30 ++--------------- drivers/gpu/drm/panel/panel-lg-sw43408.c | 22 ++++--------- .../gpu/drm/panel/panel-lincolntech-lcd197.c | 20 ++--------- drivers/gpu/drm/panel/panel-lxd-m9189a.c | 24 +++----------- .../gpu/drm/panel/panel-mantix-mlaf057we51.c | 16 +++------ .../gpu/drm/panel/panel-newvision-nv3051d.c | 22 +++---------- drivers/gpu/drm/panel/panel-novatek-nt35510.c | 13 +++++--- drivers/gpu/drm/panel/panel-novatek-nt35532.c | 23 +++---------- drivers/gpu/drm/panel/panel-novatek-nt35560.c | 19 ++--------- .../gpu/drm/panel/panel-novatek-nt36672a.c | 25 ++------------ .../gpu/drm/panel/panel-novatek-nt36672e.c | 21 +++--------- .../gpu/drm/panel/panel-novatek-nt37700f.c | 23 +++---------- drivers/gpu/drm/panel/panel-novatek-nt37801.c | 23 +++---------- .../gpu/drm/panel/panel-orisetech-otm8009a.c | 16 +++------ .../drm/panel/panel-osd-osd101t2587-53ts.c | 23 +++---------- .../drm/panel/panel-panasonic-vvx10f034n00.c | 31 ++--------------- drivers/gpu/drm/panel/panel-raydium-rm67191.c | 22 ++----------- drivers/gpu/drm/panel/panel-raydium-rm67200.c | 23 +++---------- drivers/gpu/drm/panel/panel-raydium-rm68200.c | 16 +++------ drivers/gpu/drm/panel/panel-raydium-rm692e5.c | 20 +++-------- drivers/gpu/drm/panel/panel-ronbo-rb070d30.c | 19 +++-------- drivers/gpu/drm/panel/panel-sitronix-st7701.c | 13 +++----- drivers/gpu/drm/panel/panel-sitronix-st7703.c | 14 +++----- .../drm/panel/panel-startek-kd070fhfid015.c | 24 +++----------- drivers/gpu/drm/panel/panel-summit.c | 15 +++------ .../gpu/drm/panel/panel-synaptics-r63353.c | 25 ++------------ drivers/gpu/drm/panel/panel-tdo-tl070wsh30.c | 19 +++-------- .../gpu/drm/panel/panel-xinpeng-xpp055c272.c | 20 +++-------- 44 files changed, 183 insertions(+), 751 deletions(-)
Signature · 1 line
2.43.0
PATCH v7 1/3 drm/panel: Use devm_mipi_dsi_attach 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.
--- .../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 ++++-------------- .../drm/panel/panel-boe-th101mb31ig002-28a.c | 24 ++++++------------- .../gpu/drm/panel/panel-boe-tv101wum-ll2.c | 23 ++++-------------- .../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
Re: [PATCH v7 1/3] drm/panel: Use devm_mipi_dsi_attach in BOE panels
Hello Osama,
Quoted 5 lines · Osama Abdelkader
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.
Signed-off-by Osama Abdelkader <[email protected]>
...
drivers/gpu/drm/panel/panel-boe-himax8279d.c static int panel_add(struct panel_info *pinfo)
Quoted 5 lines
drivers/gpu/drm/panel/panel-boe-himax8279d.c +0
-0@@ -851,9 +851,7 @@ static int panel_add(struct panel_info *pinfo)
As a separate series, renaming the functions in this file to name the driver name would be nice, e.g. from panel_probe() to boe_himax8279d_probe(). Would be much more grep-friendly.
drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c static int boe_panel_add(struct boe_panel *boe)
Quoted 5 lines
drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c +0
-0@@ -1736,9 +1736,7 @@ static int boe_panel_add(struct boe_panel *boe)
Same for this driver.
This patch looks good:
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
PATCH v7 2/3 drm/panel: Use managed helpers in Novatek and Raydium panels
In reply to Osama AbdelkaderUse the managed MIPI DSI attach and panel add helpers in Novatek and Raydium panel drivers and drop the corresponding manual detach and panel remove calls from remove paths.
---
v5:
- nt35510: keep manual attach/detach; remove() powers off after it. (Luca) v4:
- Use devm_drm_panel_add() instead of drm_panel_add().
drivers/gpu/drm/panel/panel-novatek-nt35510.c | 13 ++++++---- drivers/gpu/drm/panel/panel-novatek-nt35532.c | 23 ++++------------- drivers/gpu/drm/panel/panel-novatek-nt35560.c | 19 +++----------- .../gpu/drm/panel/panel-novatek-nt36672a.c | 25 ++----------------- .../gpu/drm/panel/panel-novatek-nt36672e.c | 21 ++++------------ .../gpu/drm/panel/panel-novatek-nt37700f.c | 23 ++++------------- drivers/gpu/drm/panel/panel-novatek-nt37801.c | 23 ++++------------- drivers/gpu/drm/panel/panel-raydium-rm67191.c | 22 +++------------- drivers/gpu/drm/panel/panel-raydium-rm67200.c | 23 ++++------------- drivers/gpu/drm/panel/panel-raydium-rm68200.c | 16 +++--------- drivers/gpu/drm/panel/panel-raydium-rm692e5.c | 20 +++------------ 11 files changed, 49 insertions(+), 179 deletions(-)
drivers/gpu/drm/panel/panel-novatek-nt35510.c +8 -5
@@ -1173,11 +1173,13 @@ static int nt35510_probe(struct mipi_dsi_device *dsi) nt->panel.backlight = bl; } -drm_panel_add (&nt->panel); + ret =devm_drm_panel_add (dev, &nt->panel); +if (ret) +return ret; ret =mipi_dsi_attach (dsi);if (ret <0 ) -drm_panel_remove (&nt->panel); +return ret;return 0 ; }
@@ -1187,13 +1189,14 @@ static void nt35510_remove(struct mipi_dsi_device *dsi)struct nt35510 *nt =mipi_dsi_get_drvdata (dsi);int ret; -mipi_dsi_detach (dsi); + ret =mipi_dsi_detach (dsi); +if (ret <0 ) +dev_err (&dsi->dev,"Failed to detach from DSI host: %d\n" , ret); +/* Power off */ ret =nt35510_power_off (nt);if (ret)dev_err (&dsi->dev,"Failed to power off\n" ); - -drm_panel_remove (&nt->panel); }/*
drivers/gpu/drm/panel/panel-novatek-nt35532.c +5 -18
@@ -752,29 +752,17 @@ static int nt35532_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 nt35532_remove (struct mipi_dsi_device *dsi) -{ -struct novatek_nt35532 *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 nt35532_of_match[] = { { .compatible ="flipkart,rimob-panel-nt35532-cs" , .data = &rimob_panel_desc }, {/* sentinel */ }
@@ -783,7 +771,6 @@ MODULE_DEVICE_TABLE(of, nt35532_of_match);static struct mipi_dsi_driver nt35532_driver = { .probe = nt35532_probe, - .remove = nt35532_remove, .driver = { .name ="panel-novatek-nt35532" , .of_match_table = nt35532_of_match,
drivers/gpu/drm/panel/panel-novatek-nt35560.c +3 -16
@@ -433,23 +433,11 @@ static int nt35560_probe(struct mipi_dsi_device *dsi)return dev_err_probe (dev,PTR_ERR (nt->panel.backlight),"failed to register backlight device\n" ); -drm_panel_add (&nt->panel); - - ret =mipi_dsi_attach (dsi); -if (ret <0 ) { -drm_panel_remove (&nt->panel); + ret =devm_drm_panel_add (dev, &nt->panel); +if (ret)return ret; - } - -return 0 ; -} - -static void nt35560_remove (struct mipi_dsi_device *dsi) -{ -struct nt35560 *nt =mipi_dsi_get_drvdata (dsi); -mipi_dsi_detach (dsi); -drm_panel_remove (&nt->panel); +return devm_mipi_dsi_attach (dev, dsi); }static const struct of_device_id nt35560_of_match[] = {
@@ -467,7 +455,6 @@ MODULE_DEVICE_TABLE(of, nt35560_of_match);static struct mipi_dsi_driver nt35560_driver = { .probe = nt35560_probe, - .remove = nt35560_remove, .driver = { .name ="panel-novatek-nt35560" , .of_match_table = nt35560_of_match,
drivers/gpu/drm/panel/panel-novatek-nt36672a.c +2 -23
@@ -428,9 +428,7 @@ static int nt36672a_panel_add(struct nt36672a_panel *pinfo)if (ret)return dev_err_probe (dev, ret,"Failed to get backlight\n" ); -drm_panel_add (&pinfo->base); - -return 0 ; +return devm_drm_panel_add (dev, &pinfo->base); }static int nt36672a_panel_probe (struct mipi_dsi_device *dsi)
@@ -458,25 +456,7 @@ static int nt36672a_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; - } - -return 0 ; -} - -static void nt36672a_panel_remove (struct mipi_dsi_device *dsi) -{ -struct nt36672a_panel *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 const struct of_device_id tianma_fhd_video_of_match[] = {
@@ -491,7 +471,6 @@ static struct mipi_dsi_driver nt36672a_panel_driver = { .of_match_table = tianma_fhd_video_of_match, }, .probe = nt36672a_panel_probe, - .remove = nt36672a_panel_remove, };module_mipi_dsi_driver (nt36672a_panel_driver);
drivers/gpu/drm/panel/panel-novatek-nt36672e.c +5 -16
@@ -561,27 +561,17 @@ static int nt36672e_panel_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); - goto err_dsi_attach; +return ret; }return 0 ; - -err_dsi_attach: -drm_panel_remove (&ctx->panel); -return ret; -} - -static void nt36672e_panel_remove (struct mipi_dsi_device *dsi) -{ -struct nt36672e_panel *ctx =mipi_dsi_get_drvdata (dsi); - -mipi_dsi_detach (ctx->dsi); -drm_panel_remove (&ctx->panel); }static const struct of_device_id nt36672e_of_match[] = {
@@ -599,7 +589,6 @@ static struct mipi_dsi_driver nt36672e_panel_driver = { .of_match_table = nt36672e_of_match, }, .probe = nt36672e_panel_probe, - .remove = nt36672e_panel_remove, };module_mipi_dsi_driver (nt36672e_panel_driver);
drivers/gpu/drm/panel/panel-novatek-nt37700f.c +5 -18
@@ -257,29 +257,17 @@ static int nt37700f_tianma_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 ) { -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 nt37700f_tianma_remove (struct mipi_dsi_device *dsi) -{ -struct nt37700f_tianma *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 nt37700f_tianma_of_match[] = { { .compatible ="novatek,nt37700f" }, {/* sentinel */ }
@@ -288,7 +276,6 @@ MODULE_DEVICE_TABLE(of, nt37700f_tianma_of_match);static struct mipi_dsi_driver nt37700f_tianma_driver = { .probe = nt37700f_tianma_probe, - .remove = nt37700f_tianma_remove, .driver = { .name ="panel-novatek-nt37700f" , .of_match_table = nt37700f_tianma_of_match,
drivers/gpu/drm/panel/panel-novatek-nt37801.c +5 -18
@@ -270,7 +270,9 @@ static int novatek_nt37801_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;/* This panel only supports DSC; unconditionally enable it */ dsi->dsc = &ctx->dsc;
@@ -283,27 +285,13 @@ static int novatek_nt37801_probe(struct mipi_dsi_device *dsi) ctx->dsc.bits_per_pixel =8 <<4 ;/* 4 fractional bits */ ctx->dsc.block_pred_enable = true; - 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 novatek_nt37801_remove (struct mipi_dsi_device *dsi) -{ -struct novatek_nt37801 *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 novatek_nt37801_of_match[] = { { .compatible ="novatek,nt37801" }, {}
@@ -312,7 +300,6 @@ MODULE_DEVICE_TABLE(of, novatek_nt37801_of_match);static struct mipi_dsi_driver novatek_nt37801_driver = { .probe = novatek_nt37801_probe, - .remove = novatek_nt37801_remove, .driver = { .name ="panel-novatek-nt37801" , .of_match_table = novatek_nt37801_of_match,
drivers/gpu/drm/panel/panel-raydium-rm67191.c +3 -19
@@ -590,26 +590,11 @@ static int rad_panel_probe(struct mipi_dsi_device *dsi)dev_set_drvdata (dev, panel); -drm_panel_add (&panel->panel); - - ret =mipi_dsi_attach (dsi); -if (ret) -drm_panel_remove (&panel->panel); - -return ret; -} - -static void rad_panel_remove (struct mipi_dsi_device *dsi) -{ -struct rad_panel *rad =mipi_dsi_get_drvdata (dsi); -struct device *dev = &dsi->dev; -int ret; - - ret =mipi_dsi_detach (dsi); + ret =devm_drm_panel_add (dev, &panel->panel);if (ret) -dev_err (dev,"Failed to detach from host (%d)\n" , ret); +return ret; -drm_panel_remove (&rad->panel); +return devm_mipi_dsi_attach (dev, dsi); }static const struct of_device_id rad_of_match[] = {
@@ -624,7 +609,6 @@ static struct mipi_dsi_driver rad_panel_driver = { .of_match_table = rad_of_match, }, .probe = rad_panel_probe, - .remove = rad_panel_remove, };module_mipi_dsi_driver (rad_panel_driver);
drivers/gpu/drm/panel/panel-raydium-rm67200.c +5 -18
@@ -420,29 +420,17 @@ static int raydium_rm67200_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); -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 raydium_rm67200_remove (struct mipi_dsi_device *dsi) -{ -struct raydium_rm67200 *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 regulator_bulk_data w552793baa_regulators[] = { { .supply ="vdd" , },/* 2.8V */ { .supply ="iovcc" , },/* 1.8V */
@@ -479,7 +467,6 @@ MODULE_DEVICE_TABLE(of, raydium_rm67200_of_match);static struct mipi_dsi_driver raydium_rm67200_driver = { .probe = raydium_rm67200_probe, - .remove = raydium_rm67200_remove, .driver = { .name ="panel-raydium-rm67200" , .of_match_table = raydium_rm67200_of_match,
drivers/gpu/drm/panel/panel-raydium-rm68200.c +4 -12
@@ -360,26 +360,19 @@ static int rm68200_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 rm68200_remove (struct mipi_dsi_device *dsi) -{ -struct rm68200 *ctx =mipi_dsi_get_drvdata (dsi); - -mipi_dsi_detach (dsi); -drm_panel_remove (&ctx->panel); -} -static const struct of_device_id raydium_rm68200_of_match[] = { { .compatible ="raydium,rm68200" }, { }
@@ -388,7 +381,6 @@ MODULE_DEVICE_TABLE(of, raydium_rm68200_of_match);static struct mipi_dsi_driver raydium_rm68200_driver = { .probe = rm68200_probe, - .remove = rm68200_remove, .driver = { .name ="panel-raydium-rm68200" , .of_match_table = raydium_rm68200_of_match,
drivers/gpu/drm/panel/panel-raydium-rm692e5.c +4 -16
@@ -315,7 +315,9 @@ static int rm692e5_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;/* This panel only supports DSC; unconditionally enable it */ dsi->dsc = &ctx->dsc;
@@ -331,28 +333,15 @@ static int rm692e5_probe(struct mipi_dsi_device *dsi) ctx->dsc.bits_per_pixel =8 <<4 ;/* 4 fractional bits */ ctx->dsc.block_pred_enable = true; - 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 rm692e5_remove (struct mipi_dsi_device *dsi) -{ -struct rm692e5_panel *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 rm692e5_of_match[] = { { .compatible ="fairphone,fp5-rm692e5-boe" }, { }
@@ -361,7 +350,6 @@ MODULE_DEVICE_TABLE(of, rm692e5_of_match);static struct mipi_dsi_driver rm692e5_driver = { .probe = rm692e5_probe, - .remove = rm692e5_remove, .driver = { .name ="panel-rm692e5-boe-amoled" , .of_match_table = rm692e5_of_match,
Signature · 1 line
2.43.0
Re: [PATCH v7 2/3] drm/panel: Use managed helpers in Novatek and Raydium panels
Quoted 6 lines · Osama Abdelkader
Use the managed MIPI DSI attach and panel add helpers in Novatek and Raydium 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]>
Yours,
Linus Walleij
Re: [PATCH v7 2/3] drm/panel: Use managed helpers in Novatek and Raydium panels
In reply to Osama AbdelkaderQuoted 6 lines · Osama Abdelkader
Use the managed MIPI DSI attach and panel add helpers in Novatek and Raydium 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]>
...
Quoted 10 lines
drivers/gpu/drm/panel/panel-raydium-rm68200.c +1
-1@@ -360,26 +360,19 @@ static int rm68200_probe(struct mipi_dsi_device *dsi)if (ret)return ret; -drm_panel_add (&ctx->panel); + ret =devm_drm_panel_add (dev, &ctx->panel);
drivers/gpu/drm/panel/panel-raydium-rm68200.c static int rm68200_probe(struct mipi_dsi_device *dsi) · line 371
Quoted 10 lines
drivers/gpu/drm/panel/panel-raydium-rm68200.c +3
-2+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; }
You could even do better:
if (ret < 0)
return dev_err_probe(dev, ret, "mipi_dsi_attach() failed: %d\n", ret);
Same for other drivers in this patch.
If you want you can send that as a separate series.
drivers/gpu/drm/panel/panel-raydium-rm692e5.c static int rm692e5_probe(struct mipi_dsi_device *dsi) · line 321
Quoted 13 lines
drivers/gpu/drm/panel/panel-raydium-rm692e5.c +3
-1@@ -315,7 +315,9 @@ static int rm692e5_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;
Not related to this patch, but I wonder whether this [devm_]drm_panel_add() should be moved down...
drivers/gpu/drm/panel/panel-raydium-rm692e5.c static int rm692e5_probe(struct mipi_dsi_device *dsi) · line 335
Quoted 6 lines
drivers/gpu/drm/panel/panel-raydium-rm692e5.c +0
-0/* This panel only supports DSC; unconditionally enable it */ dsi->dsc = &ctx->dsc;@@ -331,28 +333,15 @@ static int rm692e5_probe(struct mipi_dsi_device *dsi) ctx->dsc.bits_per_pixel =8 <<4 ;/* 4 fractional bits */ ctx->dsc.block_pred_enable = true;
...here, just before DSI attach. I don't see a good reason for setting ctx->dsc fields _after_ adding the panel.
drivers/gpu/drm/panel/panel-raydium-rm692e5.c static int rm692e5_probe(struct mipi_dsi_device *dsi) · line 343
Quoted 10 lines
drivers/gpu/drm/panel/panel-raydium-rm692e5.c +1
-2- 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 ; }
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
PATCH v7 3/3 drm/panel: Use managed helpers in assorted panels
In reply to Osama AbdelkaderUse the managed MIPI DSI attach and panel add helpers in assorted panel drivers and drop the corresponding manual detach and panel remove calls from remove paths.
---
v7:
- Changelog is trimmed. No code changes
from v6.
v6:
- Drop panel-simple and panel-dsi-cm: both run extra teardown after drm_panel_remove(), which devm would reorder.
- khadas-ts050, tdo-tl070wsh30: fix build break.
.../drm/panel/panel-asus-z00t-tm5p5-n35596.c | 20 +++-------- .../gpu/drm/panel/panel-chipwealth-ch13726a.c | 20 +++-------- drivers/gpu/drm/panel/panel-ebbg-ft8719.c | 20 +++-------- drivers/gpu/drm/panel/panel-elida-kd35t133.c | 20 +++-------- .../gpu/drm/panel/panel-feixin-k101-im2ba02.c | 19 +++-------- .../drm/panel/panel-feiyang-fy07024di26a30d.c | 19 +++-------- drivers/gpu/drm/panel/panel-hydis-hv101hd1.c | 24 +++----------- drivers/gpu/drm/panel/panel-innolux-p079zca.c | 33 +++---------------- .../gpu/drm/panel/panel-jadard-jd9365da-h3.c | 19 +++-------- drivers/gpu/drm/panel/panel-khadas-ts050.c | 23 +++---------- .../drm/panel/panel-kingdisplay-kd097d04.c | 30 ++--------------- drivers/gpu/drm/panel/panel-lg-sw43408.c | 22 ++++--------- .../gpu/drm/panel/panel-lincolntech-lcd197.c | 20 ++--------- drivers/gpu/drm/panel/panel-lxd-m9189a.c | 24 +++----------- .../gpu/drm/panel/panel-mantix-mlaf057we51.c | 16 +++------ .../gpu/drm/panel/panel-newvision-nv3051d.c | 22 +++---------- .../gpu/drm/panel/panel-orisetech-otm8009a.c | 16 +++------ .../drm/panel/panel-osd-osd101t2587-53ts.c | 23 +++---------- .../drm/panel/panel-panasonic-vvx10f034n00.c | 31 ++--------------- drivers/gpu/drm/panel/panel-ronbo-rb070d30.c | 19 +++-------- drivers/gpu/drm/panel/panel-sitronix-st7701.c | 13 +++----- drivers/gpu/drm/panel/panel-sitronix-st7703.c | 14 +++----- .../drm/panel/panel-startek-kd070fhfid015.c | 24 +++----------- drivers/gpu/drm/panel/panel-summit.c | 15 +++------ .../gpu/drm/panel/panel-synaptics-r63353.c | 25 ++------------ drivers/gpu/drm/panel/panel-tdo-tl070wsh30.c | 19 +++-------- .../gpu/drm/panel/panel-xinpeng-xpp055c272.c | 20 +++-------- 27 files changed, 109 insertions(+), 461 deletions(-)
drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c +4 -16
@@ -262,9 +262,11 @@ static int tm5p5_nt35596_probe(struct mipi_dsi_device *dsi)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 (&dsi->dev, dsi);if (ret <0 ) {dev_err (dev,"Failed to attach to DSI host: %d\n" , ret);return ret;
@@ -273,19 +275,6 @@ static int tm5p5_nt35596_probe(struct mipi_dsi_device *dsi)return 0 ; } -static void tm5p5_nt35596_remove (struct mipi_dsi_device *dsi) -{ -struct tm5p5_nt35596 *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 tm5p5_nt35596_of_match[] = { { .compatible ="asus,z00t-tm5p5-n35596" }, {/* sentinel */ }
@@ -294,7 +283,6 @@ MODULE_DEVICE_TABLE(of, tm5p5_nt35596_of_match);static struct mipi_dsi_driver tm5p5_nt35596_driver = { .probe = tm5p5_nt35596_probe, - .remove = tm5p5_nt35596_remove, .driver = { .name ="panel-tm5p5-nt35596" , .of_match_table = tm5p5_nt35596_of_match,
drivers/gpu/drm/panel/panel-chipwealth-ch13726a.c +4 -16
@@ -290,30 +290,19 @@ static int ch13726a_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 (&dsi->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 ch13726a_remove (struct mipi_dsi_device *dsi) -{ -struct ch13726a_panel *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 ch13726a_of_match[] = { { .compatible ="ayntec,thor-panel-bottom" , .data = &thor_bottom_desc }, {/* sentinel */ }
@@ -322,7 +311,6 @@ MODULE_DEVICE_TABLE(of, ch13726a_of_match);static struct mipi_dsi_driver ch13726a_driver = { .probe = ch13726a_probe, - .remove = ch13726a_remove, .driver = { .name ="panel-ch13726a-amoled" , .of_match_table = ch13726a_of_match,
drivers/gpu/drm/panel/panel-ebbg-ft8719.c +4 -16
@@ -202,30 +202,19 @@ static int ebbg_ft8719_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 (&dsi->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 ebbg_ft8719_remove (struct mipi_dsi_device *dsi) -{ -struct ebbg_ft8719 *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 ebbg_ft8719_of_match[] = { { .compatible ="ebbg,ft8719" }, {/* sentinel */ }
@@ -234,7 +223,6 @@ MODULE_DEVICE_TABLE(of, ebbg_ft8719_of_match);static struct mipi_dsi_driver ebbg_ft8719_driver = { .probe = ebbg_ft8719_probe, - .remove = ebbg_ft8719_remove, .driver = { .name ="panel-ebbg-ft8719" , .of_match_table = ebbg_ft8719_of_match,
drivers/gpu/drm/panel/panel-elida-kd35t133.c +4 -16
@@ -254,30 +254,19 @@ static int kd35t133_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 (&dsi->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 kd35t133_remove (struct mipi_dsi_device *dsi) -{ -struct kd35t133 *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 kd35t133_of_match[] = { { .compatible ="elida,kd35t133" }, {/* sentinel */ }
@@ -290,7 +279,6 @@ static struct mipi_dsi_driver kd35t133_driver = { .of_match_table = kd35t133_of_match, }, .probe = kd35t133_probe, - .remove = kd35t133_remove, };module_mipi_dsi_driver (kd35t133_driver);
drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c +5 -14
@@ -468,29 +468,21 @@ static int k101_im2ba02_dsi_probe(struct mipi_dsi_device *dsi)if (ret)return ret; -drm_panel_add (&ctx->panel); + ret =devm_drm_panel_add (&dsi->dev, &ctx->panel); +if (ret) +return ret; dsi->mode_flags =MIPI_DSI_MODE_VIDEO ; dsi->format =MIPI_DSI_FMT_RGB888 ; dsi->lanes =4 ; - ret =mipi_dsi_attach (dsi); -if (ret <0 ) { -drm_panel_remove (&ctx->panel); + ret =devm_mipi_dsi_attach (&dsi->dev, dsi); +if (ret <0 )return ret; - }return 0 ; } -static void k101_im2ba02_dsi_remove (struct mipi_dsi_device *dsi) -{ -struct k101_im2ba02 *ctx =mipi_dsi_get_drvdata (dsi); - -mipi_dsi_detach (dsi); -drm_panel_remove (&ctx->panel); -} -static const struct of_device_id k101_im2ba02_of_match[] = { { .compatible ="feixin,k101-im2ba02" , }, {/* sentinel */ }
@@ -499,7 +491,6 @@ MODULE_DEVICE_TABLE(of, k101_im2ba02_of_match);static struct mipi_dsi_driver k101_im2ba02_driver = { .probe = k101_im2ba02_dsi_probe, - .remove = k101_im2ba02_dsi_remove, .driver = { .name ="feixin-k101-im2ba02" , .of_match_table = k101_im2ba02_of_match,
drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c +5 -14
@@ -213,29 +213,21 @@ static int feiyang_dsi_probe(struct mipi_dsi_device *dsi)if (ret)return ret; -drm_panel_add (&ctx->panel); + ret =devm_drm_panel_add (&dsi->dev, &ctx->panel); +if (ret) +return ret; dsi->mode_flags =MIPI_DSI_MODE_VIDEO_BURST ; dsi->format =MIPI_DSI_FMT_RGB888 ; dsi->lanes =4 ; - ret =mipi_dsi_attach (dsi); -if (ret <0 ) { -drm_panel_remove (&ctx->panel); + ret =devm_mipi_dsi_attach (&dsi->dev, dsi); +if (ret <0 )return ret; - }return 0 ; } -static void feiyang_dsi_remove (struct mipi_dsi_device *dsi) -{ -struct feiyang *ctx =mipi_dsi_get_drvdata (dsi); - -mipi_dsi_detach (dsi); -drm_panel_remove (&ctx->panel); -} -static const struct of_device_id feiyang_of_match[] = { { .compatible ="feiyang,fy07024di26a30d" , }, {/* sentinel */ }
@@ -244,7 +236,6 @@ MODULE_DEVICE_TABLE(of, feiyang_of_match);static struct mipi_dsi_driver feiyang_driver = { .probe = feiyang_dsi_probe, - .remove = feiyang_dsi_remove, .driver = { .name ="feiyang-fy07024di26a30d" , .of_match_table = feiyang_of_match,
drivers/gpu/drm/panel/panel-hydis-hv101hd1.c +5 -19
@@ -142,30 +142,17 @@ static int hv101hd1_probe(struct mipi_dsi_device *dsi)if (ret)return dev_err_probe (dev, ret,"Failed to get backlight\n" ); -drm_panel_add (&hv->panel); + ret =devm_drm_panel_add (dev, &hv->panel); +if (ret) +return ret; - ret =mipi_dsi_attach (dsi); -if (ret) { -drm_panel_remove (&hv->panel); + ret =devm_mipi_dsi_attach (&dsi->dev, dsi); +if (ret)return dev_err_probe (dev, ret,"Failed to attach to DSI host\n" ); - }return 0 ; } -static void hv101hd1_remove (struct mipi_dsi_device *dsi) -{ -struct hv101hd1 *hv =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 (&hv->panel); -} -static const struct of_device_id hv101hd1_of_match[] = { { .compatible ="hydis,hv101hd1" }, {/* sentinel */ }
@@ -178,7 +165,6 @@ static struct mipi_dsi_driver hv101hd1_driver = { .of_match_table = hv101hd1_of_match, }, .probe = hv101hd1_probe, - .remove = hv101hd1_remove, };module_mipi_dsi_driver (hv101hd1_driver);
drivers/gpu/drm/panel/panel-innolux-p079zca.c +4 -29
@@ -416,7 +416,9 @@ static int innolux_panel_add(struct mipi_dsi_device *dsi,if (err)return err; -drm_panel_add (&innolux->base); + err =devm_drm_panel_add (dev, &innolux->base); +if (err) +return err;mipi_dsi_set_drvdata (dsi, innolux); innolux->link = dsi;
@@ -424,15 +426,9 @@ static int innolux_panel_add(struct mipi_dsi_device *dsi,return 0 ; } -static void innolux_panel_del (struct innolux_panel *innolux) -{ -drm_panel_remove (&innolux->base); -} -static int innolux_panel_probe (struct mipi_dsi_device *dsi) {const struct panel_desc *desc; -struct innolux_panel *innolux;int err; desc =of_device_get_match_data (&dsi->dev);
@@ -444,27 +440,7 @@ static int innolux_panel_probe(struct mipi_dsi_device *dsi)if (err <0 )return err; - err =mipi_dsi_attach (dsi); -if (err <0 ) { - innolux =mipi_dsi_get_drvdata (dsi); -innolux_panel_del (innolux); -return err; - } - -return 0 ; -} - -static void innolux_panel_remove (struct mipi_dsi_device *dsi) -{ -struct innolux_panel *innolux =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); - -innolux_panel_del (innolux); +return devm_mipi_dsi_attach (&dsi->dev, dsi); }static struct mipi_dsi_driver innolux_panel_driver = {
@@ -473,7 +449,6 @@ static struct mipi_dsi_driver innolux_panel_driver = { .of_match_table = innolux_of_match, }, .probe = innolux_panel_probe, - .remove = innolux_panel_remove, };module_mipi_dsi_driver (innolux_panel_driver);
drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c +4 -15
@@ -3245,25 +3245,15 @@ static int jadard_dsi_probe(struct mipi_dsi_device *dsi) jadard->panel.prepare_prev_first = true; -drm_panel_add (&jadard->panel); + ret =devm_drm_panel_add (dev, &jadard->panel); +if (ret) +return ret;mipi_dsi_set_drvdata (dsi, jadard); jadard->dsi = dsi; jadard->desc = desc; - ret =mipi_dsi_attach (dsi); -if (ret <0 ) -drm_panel_remove (&jadard->panel); - -return ret; -} - -static void jadard_dsi_remove (struct mipi_dsi_device *dsi) -{ -struct jadard *jadard =mipi_dsi_get_drvdata (dsi); - -mipi_dsi_detach (dsi); -drm_panel_remove (&jadard->panel); +return devm_mipi_dsi_attach (&dsi->dev, dsi); }static const struct of_device_id jadard_of_match[] = {
@@ -3333,7 +3323,6 @@ MODULE_DEVICE_TABLE(of, jadard_of_match);static struct mipi_dsi_driver jadard_driver = { .probe = jadard_dsi_probe, - .remove = jadard_dsi_remove, .driver = { .name ="jadard-jd9365da" , .of_match_table = jadard_of_match,
drivers/gpu/drm/panel/panel-khadas-ts050.c +4 -19
@@ -825,7 +825,9 @@ static int khadas_ts050_panel_add(struct khadas_ts050_panel *khadas_ts050)if (err)return err; -drm_panel_add (&khadas_ts050->base); + err =devm_drm_panel_add (dev, &khadas_ts050->base); +if (err) +return err;return 0 ; }
@@ -862,23 +864,7 @@ static int khadas_ts050_panel_probe(struct mipi_dsi_device *dsi)if (err <0 )return err; - err =mipi_dsi_attach (dsi); -if (err) -drm_panel_remove (&khadas_ts050->base); - -return err; -} - -static void khadas_ts050_panel_remove (struct mipi_dsi_device *dsi) -{ -struct khadas_ts050_panel *khadas_ts050 =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 (&khadas_ts050->base); +return devm_mipi_dsi_attach (&dsi->dev, dsi); }static struct mipi_dsi_driver khadas_ts050_panel_driver = {
@@ -887,7 +873,6 @@ static struct mipi_dsi_driver khadas_ts050_panel_driver = { .of_match_table = khadas_ts050_of_match, }, .probe = khadas_ts050_panel_probe, - .remove = khadas_ts050_panel_remove, };module_mipi_dsi_driver (khadas_ts050_panel_driver);
drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c +2 -28
@@ -341,14 +341,7 @@ static int kingdisplay_panel_add(struct kingdisplay_panel *kingdisplay)if (err)return err; -drm_panel_add (&kingdisplay->base); - -return 0 ; -} - -static void kingdisplay_panel_del (struct kingdisplay_panel *kingdisplay) -{ -drm_panel_remove (&kingdisplay->base); +return devm_drm_panel_add (dev, &kingdisplay->base); }static int kingdisplay_panel_probe (struct mipi_dsi_device *dsi)
@@ -375,25 +368,7 @@ static int kingdisplay_panel_probe(struct mipi_dsi_device *dsi)if (err <0 )return err; - err =mipi_dsi_attach (dsi); -if (err <0 ) { -kingdisplay_panel_del (kingdisplay); -return err; - } - -return 0 ; -} - -static void kingdisplay_panel_remove (struct mipi_dsi_device *dsi) -{ -struct kingdisplay_panel *kingdisplay =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); - -kingdisplay_panel_del (kingdisplay); +return devm_mipi_dsi_attach (&dsi->dev, dsi); }static struct mipi_dsi_driver kingdisplay_panel_driver = {
@@ -402,7 +377,6 @@ static struct mipi_dsi_driver kingdisplay_panel_driver = { .of_match_table = kingdisplay_of_match, }, .probe = kingdisplay_panel_probe, - .remove = kingdisplay_panel_remove, };module_mipi_dsi_driver (kingdisplay_panel_driver);
drivers/gpu/drm/panel/panel-lg-sw43408.c +6 -16
@@ -254,8 +254,11 @@ static int sw43408_add(struct sw43408_panel *ctx) ctx->base.prepare_prev_first = true; -drm_panel_add (&ctx->base); -return ret; + ret =devm_drm_panel_add (dev, &ctx->base); +if (ret) +return ret; + +return 0 ; }static int sw43408_probe (struct mipi_dsi_device *dsi)
@@ -294,19 +297,7 @@ static int sw43408_probe(struct mipi_dsi_device *dsi) dsi->dsc = &ctx->dsc; -return mipi_dsi_attach (dsi); -} - -static void sw43408_remove (struct mipi_dsi_device *dsi) -{ -struct sw43408_panel *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->base); +return devm_mipi_dsi_attach (&dsi->dev, dsi); }static struct mipi_dsi_driver sw43408_driver = {
@@ -315,7 +306,6 @@ static struct mipi_dsi_driver sw43408_driver = { .of_match_table = sw43408_of_match, }, .probe = sw43408_probe, - .remove = sw43408_remove, };module_mipi_dsi_driver (sw43408_driver);
drivers/gpu/drm/panel/panel-lincolntech-lcd197.c +3 -17
@@ -220,24 +220,11 @@ static int lincoln_lcd197_panel_probe(struct mipi_dsi_device *dsi)if (err)return err; -drm_panel_add (&lcd->panel); - err =mipi_dsi_attach (dsi); + err =devm_drm_panel_add (dev, &lcd->panel);if (err) -drm_panel_remove (&lcd->panel); - -return err; -} - -static void lincoln_lcd197_panel_remove (struct mipi_dsi_device *dsi) -{ -struct lincoln_lcd197_panel *lcd =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); +return err; -drm_panel_remove (&lcd->panel); +return devm_mipi_dsi_attach (&dsi->dev, dsi); }static const struct of_device_id lincoln_lcd197_of_match[] = {
@@ -252,7 +239,6 @@ static struct mipi_dsi_driver lincoln_lcd197_panel_driver = { .of_match_table = lincoln_lcd197_of_match, }, .probe = lincoln_lcd197_panel_probe, - .remove = lincoln_lcd197_panel_remove, };module_mipi_dsi_driver (lincoln_lcd197_panel_driver);
drivers/gpu/drm/panel/panel-lxd-m9189a.c +5 -19
@@ -200,28 +200,15 @@ static int lxd_m9189_probe(struct mipi_dsi_device *dsi)if (ret)return dev_err_probe (dev, ret,"Failed to get backlight\n" ); -drm_panel_add (&m9189->panel); - - ret =mipi_dsi_attach (dsi); -if (ret <0 ) { -dev_err_probe (dev, ret,"Failed to attach to DSI host\n" ); -drm_panel_remove (&m9189->panel); + ret =devm_drm_panel_add (dev, &m9189->panel); +if (ret)return ret; - } -return 0 ; -} - -static void lxd_m9189_remove (struct mipi_dsi_device *dsi) -{ -struct m9189_panel *m9189 =mipi_dsi_get_drvdata (dsi); -int ret; - - ret =mipi_dsi_detach (dsi); + ret =devm_mipi_dsi_attach (&dsi->dev, dsi);if (ret <0 ) -dev_err (&dsi->dev,"Failed to detach from DSI host: %d\n" , ret); +return dev_err_probe (dev, ret,"Failed to attach to DSI host\n" ); -drm_panel_remove (&m9189->panel); +return 0 ; }static const struct of_device_id lxd_m9189_of_match[] = {
@@ -232,7 +219,6 @@ MODULE_DEVICE_TABLE(of, lxd_m9189_of_match);static struct mipi_dsi_driver lxd_m9189_driver = { .probe = lxd_m9189_probe, - .remove = lxd_m9189_remove, .driver = { .name ="panel-lxd-m9189a" , .of_match_table = lxd_m9189_of_match,
drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c +4 -12
@@ -278,12 +278,13 @@ static int mantix_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 (&dsi->dev, dsi);if (ret <0 ) {dev_err (dev,"mipi_dsi_attach failed (%d). Is host ready?\n" , ret); -drm_panel_remove (&ctx->panel);return ret; }
@@ -295,14 +296,6 @@ static int mantix_probe(struct mipi_dsi_device *dsi)return 0 ; } -static void mantix_remove (struct mipi_dsi_device *dsi) -{ -struct mantix *ctx =mipi_dsi_get_drvdata (dsi); - -mipi_dsi_detach (dsi); -drm_panel_remove (&ctx->panel); -} -static const struct of_device_id mantix_of_match[] = { { .compatible ="mantix,mlaf057we51-x" , .data = &default_mode_mantix }, { .compatible ="ys,ys57pss36bh5gq" , .data = &default_mode_ys },
@@ -312,7 +305,6 @@ MODULE_DEVICE_TABLE(of, mantix_of_match);static struct mipi_dsi_driver mantix_driver = { .probe = mantix_probe, - .remove = mantix_remove, .driver = { .name =DRV_NAME , .of_match_table = mantix_of_match,
drivers/gpu/drm/panel/panel-newvision-nv3051d.c +4 -18
@@ -397,12 +397,13 @@ static int panel_nv3051d_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 (&dsi->dev, dsi);if (ret <0 ) {dev_err (dev,"mipi_dsi_attach failed: %d\n" , ret); -drm_panel_remove (&ctx->panel);return ret; }
@@ -418,20 +419,6 @@ static void panel_nv3051d_shutdown(struct mipi_dsi_device *dsi)drm_panel_disable (&ctx->panel); } -static void panel_nv3051d_remove (struct mipi_dsi_device *dsi) -{ -struct panel_nv3051d *ctx =mipi_dsi_get_drvdata (dsi); -int ret; - -panel_nv3051d_shutdown (dsi); - - 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 drm_display_mode nv3051d_rgxx3_modes[] = { {/* 120hz */ .hdisplay =640 ,
@@ -531,7 +518,6 @@ static struct mipi_dsi_driver newvision_nv3051d_driver = { .of_match_table = newvision_nv3051d_of_match, }, .probe = panel_nv3051d_probe, - .remove = panel_nv3051d_remove, .shutdown = panel_nv3051d_shutdown, };module_mipi_dsi_driver (newvision_nv3051d_driver);
drivers/gpu/drm/panel/panel-orisetech-otm8009a.c +4 -12
@@ -432,26 +432,19 @@ static int otm8009a_probe(struct mipi_dsi_device *dsi) ctx->bl_dev->props.power =BACKLIGHT_POWER_OFF ; ctx->bl_dev->props.type =BACKLIGHT_RAW ; -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 (&dsi->dev, dsi);if (ret <0 ) {dev_err (dev,"mipi_dsi_attach failed. Is host ready?\n" ); -drm_panel_remove (&ctx->panel);return ret; }return 0 ; } -static void otm8009a_remove (struct mipi_dsi_device *dsi) -{ -struct otm8009a *ctx =mipi_dsi_get_drvdata (dsi); - -mipi_dsi_detach (dsi); -drm_panel_remove (&ctx->panel); -} -static const struct of_device_id orisetech_otm8009a_of_match[] = { { .compatible ="orisetech,otm8009a" }, { }
@@ -460,7 +453,6 @@ MODULE_DEVICE_TABLE(of, orisetech_otm8009a_of_match);static struct mipi_dsi_driver orisetech_otm8009a_driver = { .probe = otm8009a_probe, - .remove = otm8009a_remove, .driver = { .name ="panel-orisetech-otm8009a" , .of_match_table = orisetech_otm8009a_of_match,
drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c +4 -19
@@ -134,7 +134,9 @@ static int osd101t2587_panel_add(struct osd101t2587_panel *osd101t2587)if (ret)return ret; -drm_panel_add (&osd101t2587->base); + ret =devm_drm_panel_add (dev, &osd101t2587->base); +if (ret) +return ret;return 0 ; }
@@ -172,23 +174,7 @@ static int osd101t2587_panel_probe(struct mipi_dsi_device *dsi)if (ret <0 )return ret; - ret =mipi_dsi_attach (dsi); -if (ret) -drm_panel_remove (&osd101t2587->base); - -return ret; -} - -static void osd101t2587_panel_remove (struct mipi_dsi_device *dsi) -{ -struct osd101t2587_panel *osd101t2587 =mipi_dsi_get_drvdata (dsi); -int ret; - -drm_panel_remove (&osd101t2587->base); - - ret =mipi_dsi_detach (dsi); -if (ret <0 ) -dev_err (&dsi->dev,"failed to detach from DSI host: %d\n" , ret); +return devm_mipi_dsi_attach (&dsi->dev, dsi); }static struct mipi_dsi_driver osd101t2587_panel_driver = {
@@ -197,7 +183,6 @@ static struct mipi_dsi_driver osd101t2587_panel_driver = { .of_match_table = osd101t2587_of_match, }, .probe = osd101t2587_panel_probe, - .remove = osd101t2587_panel_remove, };module_mipi_dsi_driver (osd101t2587_panel_driver);
drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c +2 -29
@@ -172,15 +172,7 @@ static int wuxga_nt_panel_add(struct wuxga_nt_panel *wuxga_nt)if (ret)return ret; -drm_panel_add (&wuxga_nt->base); - -return 0 ; -} - -static void wuxga_nt_panel_del (struct wuxga_nt_panel *wuxga_nt) -{ -if (wuxga_nt->base.dev) -drm_panel_remove (&wuxga_nt->base); +return devm_drm_panel_add (dev, &wuxga_nt->base); }static int wuxga_nt_panel_probe (struct mipi_dsi_device *dsi)
@@ -210,25 +202,7 @@ static int wuxga_nt_panel_probe(struct mipi_dsi_device *dsi)if (ret <0 )return ret; - ret =mipi_dsi_attach (dsi); -if (ret <0 ) { -wuxga_nt_panel_del (wuxga_nt); -return ret; - } - -return 0 ; -} - -static void wuxga_nt_panel_remove (struct mipi_dsi_device *dsi) -{ -struct wuxga_nt_panel *wuxga_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); - -wuxga_nt_panel_del (wuxga_nt); +return devm_mipi_dsi_attach (&dsi->dev, dsi); }static struct mipi_dsi_driver wuxga_nt_panel_driver = {
@@ -237,7 +211,6 @@ static struct mipi_dsi_driver wuxga_nt_panel_driver = { .of_match_table = wuxga_nt_of_match, }, .probe = wuxga_nt_panel_probe, - .remove = wuxga_nt_panel_remove, };module_mipi_dsi_driver (wuxga_nt_panel_driver);
drivers/gpu/drm/panel/panel-ronbo-rb070d30.c +5 -14
@@ -192,29 +192,21 @@ static int rb070d30_panel_dsi_probe(struct mipi_dsi_device *dsi)if (ret)return ret; -drm_panel_add (&ctx->panel); + ret =devm_drm_panel_add (&dsi->dev, &ctx->panel); +if (ret) +return ret; dsi->mode_flags =MIPI_DSI_MODE_VIDEO |MIPI_DSI_MODE_VIDEO_BURST |MIPI_DSI_MODE_LPM ; dsi->format =MIPI_DSI_FMT_RGB888 ; dsi->lanes =4 ; - ret =mipi_dsi_attach (dsi); -if (ret <0 ) { -drm_panel_remove (&ctx->panel); + ret =devm_mipi_dsi_attach (&dsi->dev, dsi); +if (ret <0 )return ret; - }return 0 ; } -static void rb070d30_panel_dsi_remove (struct mipi_dsi_device *dsi) -{ -struct rb070d30_panel *ctx =mipi_dsi_get_drvdata (dsi); - -mipi_dsi_detach (dsi); -drm_panel_remove (&ctx->panel); -} -static const struct of_device_id rb070d30_panel_of_match[] = { { .compatible ="ronbo,rb070d30" }, {/* sentinel */ },
@@ -223,7 +215,6 @@ MODULE_DEVICE_TABLE(of, rb070d30_panel_of_match);static struct mipi_dsi_driver rb070d30_panel_driver = { .probe = rb070d30_panel_dsi_probe, - .remove = rb070d30_panel_dsi_remove, .driver = { .name ="panel-ronbo-rb070d30" , .of_match_table = rb070d30_panel_of_match,
drivers/gpu/drm/panel/panel-sitronix-st7701.c +4 -9
@@ -1263,7 +1263,6 @@ static void st7701_cleanup(void *data) {struct st7701 *st7701 = (struct st7701 *)data; -drm_panel_remove (&st7701->panel);drm_panel_disable (&st7701->panel);drm_panel_unprepare (&st7701->panel); }
@@ -1318,7 +1317,9 @@ static int st7701_probe(struct device *dev, int connector_type)if (ret)return ret; -drm_panel_add (&st7701->panel); + ret =devm_drm_panel_add (dev, &st7701->panel); +if (ret) +return ret;dev_set_drvdata (dev, st7701); st7701->desc = desc;
@@ -1347,7 +1348,7 @@ static int st7701_dsi_probe(struct mipi_dsi_device *dsi) dsi->format = st7701->desc->format; dsi->lanes = st7701->desc->lanes; - err =mipi_dsi_attach (dsi); + err =devm_mipi_dsi_attach (&dsi->dev, dsi);if (err)return dev_err_probe (&dsi->dev, err,"Failed to init MIPI DSI\n" );
@@ -1379,11 +1380,6 @@ static int st7701_spi_probe(struct spi_device *spi)return 0 ; } -static void st7701_dsi_remove (struct mipi_dsi_device *dsi) -{ -mipi_dsi_detach (dsi); -} -static const struct of_device_id st7701_dsi_of_match[] = { { .compatible ="anbernic,rg-arc-panel" , .data = &rg_arc_desc }, { .compatible ="densitron,dmt028vghmcmi-1a" , .data = &dmt028vghmcmi_1a_desc },
@@ -1408,7 +1404,6 @@ MODULE_DEVICE_TABLE(spi, st7701_spi_ids);static struct mipi_dsi_driver st7701_dsi_driver = { .probe = st7701_dsi_probe, - .remove = st7701_dsi_remove, .driver = { .name ="st7701" , .of_match_table = st7701_dsi_of_match,
drivers/gpu/drm/panel/panel-sitronix-st7703.c +4 -10
@@ -977,12 +977,13 @@ static int st7703_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 (&dsi->dev, dsi);if (ret <0 ) {dev_err (dev,"mipi_dsi_attach failed (%d). Is host ready?\n" , ret); -drm_panel_remove (&ctx->panel);return ret; }
@@ -998,13 +999,6 @@ static int st7703_probe(struct mipi_dsi_device *dsi)static void st7703_remove (struct mipi_dsi_device *dsi) {struct st7703 *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);st7703_debugfs_remove (ctx); }
drivers/gpu/drm/panel/panel-startek-kd070fhfid015.c +4 -20
@@ -286,7 +286,9 @@ static int stk_panel_add(struct stk_panel *stk)return ret; } -drm_panel_add (&stk->base); + ret =devm_drm_panel_add (dev, &stk->base); +if (ret) +return ret;return 0 ; }
@@ -315,24 +317,7 @@ static int stk_panel_probe(struct mipi_dsi_device *dsi)if (ret <0 )return ret; - ret =mipi_dsi_attach (dsi); -if (ret <0 ) -drm_panel_remove (&stk->base); - -return 0 ; -} - -static void stk_panel_remove (struct mipi_dsi_device *dsi) -{ -struct stk_panel *stk =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 (&stk->base); +return devm_mipi_dsi_attach (&dsi->dev, dsi); }static struct mipi_dsi_driver stk_panel_driver = {
@@ -341,7 +326,6 @@ static struct mipi_dsi_driver stk_panel_driver = { .of_match_table = stk_of_match, }, .probe = stk_panel_probe, - .remove = stk_panel_remove, };module_mipi_dsi_driver (stk_panel_driver);
drivers/gpu/drm/panel/panel-summit.c +4 -11
@@ -88,17 +88,11 @@ static int summit_probe(struct mipi_dsi_device *dsi)if (IS_ERR (s_data->bl))return PTR_ERR (s_data->bl); -drm_panel_add (&s_data->panel); - -return mipi_dsi_attach (dsi); -} - -static void summit_remove (struct mipi_dsi_device *dsi) -{ -struct summit_data *s_data =mipi_dsi_get_drvdata (dsi); + ret =devm_drm_panel_add (dev, &s_data->panel); +if (ret) +return ret; -mipi_dsi_detach (dsi); -drm_panel_remove (&s_data->panel); +return devm_mipi_dsi_attach (&dsi->dev, dsi); }static int summit_suspend (struct device *dev)
@@ -120,7 +114,6 @@ MODULE_DEVICE_TABLE(of, summit_of_match);static struct mipi_dsi_driver summit_driver = { .probe = summit_probe, - .remove = summit_remove, .driver = { .name ="panel-summit" , .of_match_table = summit_of_match,
drivers/gpu/drm/panel/panel-synaptics-r63353.c +3 -22
@@ -265,29 +265,11 @@ static int r63353_panel_probe(struct mipi_dsi_device *dsi)if (ret)return ret; -drm_panel_add (&panel->base); - - ret =mipi_dsi_attach (dsi); -if (ret <0 ) { -dev_err (dev,"mipi_dsi_attach failed: %d\n" , ret); -drm_panel_remove (&panel->base); + ret =devm_drm_panel_add (dev, &panel->base); +if (ret)return ret; - } - -return ret; -} - -static void r63353_panel_remove (struct mipi_dsi_device *dsi) -{ -struct r63353_panel *rpanel =mipi_dsi_get_drvdata (dsi); -struct device *dev = &dsi->dev; -int ret; - - ret =mipi_dsi_detach (dsi); -if (ret <0 ) -dev_err (dev,"Failed to detach from host (%d)\n" , ret); -drm_panel_remove (&rpanel->base); +return devm_mipi_dsi_attach (&dsi->dev, dsi); }static void r63353_panel_shutdown (struct mipi_dsi_device *dsi)
@@ -319,7 +301,6 @@ static struct mipi_dsi_driver r63353_panel_driver = { .of_match_table = r63353_of_match, }, .probe = r63353_panel_probe, - .remove = r63353_panel_remove, .shutdown = r63353_panel_shutdown, };
drivers/gpu/drm/panel/panel-tdo-tl070wsh30.c +4 -15
@@ -150,7 +150,9 @@ static int tdo_tl070wsh30_panel_add(struct tdo_tl070wsh30_panel *tdo_tl070wsh30)if (err)return err; -drm_panel_add (&tdo_tl070wsh30->base); + err =devm_drm_panel_add (dev, &tdo_tl070wsh30->base); +if (err) +return err;return 0 ; }
@@ -179,19 +181,7 @@ static int tdo_tl070wsh30_panel_probe(struct mipi_dsi_device *dsi)if (err <0 )return err; -return mipi_dsi_attach (dsi); -} - -static void tdo_tl070wsh30_panel_remove (struct mipi_dsi_device *dsi) -{ -struct tdo_tl070wsh30_panel *tdo_tl070wsh30 =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 (&tdo_tl070wsh30->base); +return devm_mipi_dsi_attach (&dsi->dev, dsi); }static struct mipi_dsi_driver tdo_tl070wsh30_panel_driver = {
@@ -200,7 +190,6 @@ static struct mipi_dsi_driver tdo_tl070wsh30_panel_driver = { .of_match_table = tdo_tl070wsh30_of_match, }, .probe = tdo_tl070wsh30_panel_probe, - .remove = tdo_tl070wsh30_panel_remove, };module_mipi_dsi_driver (tdo_tl070wsh30_panel_driver);
drivers/gpu/drm/panel/panel-xinpeng-xpp055c272.c +4 -16
@@ -274,30 +274,19 @@ static int xpp055c272_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 (&dsi->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 xpp055c272_remove (struct mipi_dsi_device *dsi) -{ -struct xpp055c272 *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 xpp055c272_of_match[] = { { .compatible ="xinpeng,xpp055c272" }, {/* sentinel */ }
@@ -310,7 +299,6 @@ static struct mipi_dsi_driver xpp055c272_driver = { .of_match_table = xpp055c272_of_match, }, .probe = xpp055c272_probe, - .remove = xpp055c272_remove, };module_mipi_dsi_driver (xpp055c272_driver);
Signature · 1 line
2.43.0
Re: [PATCH v7 3/3] drm/panel: Use managed helpers in assorted panels
Quoted 6 lines · Osama Abdelkader
Use the managed MIPI DSI attach and panel add helpers in assorted 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]>
...
Quoted 8 lines
drivers/gpu/drm/panel/panel-ebbg-ft8719.c +1
-1@@ -202,30 +202,19 @@ static int ebbg_ft8719_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);
drivers/gpu/drm/panel/panel-ebbg-ft8719.c static int ebbg_ft8719_probe(struct mipi_dsi_device *dsi) · line 213
Quoted 10 lines
drivers/gpu/drm/panel/panel-ebbg-ft8719.c +3
-2+if (ret) +return ret; - ret =mipi_dsi_attach (dsi); + ret =devm_mipi_dsi_attach (&dsi->dev, dsi);if (ret <0 ) {dev_err (dev,"Failed to attach to DSI host: %d\n" , ret); -drm_panel_remove (&ctx->panel);return ret; }
As for patch 2, this could be even simpler by using dev_err_probe(). Same for other drivers in this patch.
drivers/gpu/drm/panel/panel-sitronix-st7701.c static void st7701_cleanup(void *data) · line 1268
Quoted 10 lines
drivers/gpu/drm/panel/panel-sitronix-st7701.c +0
-1@@ -1263,7 +1263,6 @@ static void st7701_cleanup(void *data) {struct st7701 *st7701 = (struct st7701 *)data; -drm_panel_remove (&st7701->panel);drm_panel_disable (&st7701->panel);drm_panel_unprepare (&st7701->panel); }
The last two calls here appear inappropriate IMO. However it's not an issue with your patch.
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Hi All,
Just a gentle ping on this series. It's been many weeks and I wanted to see if anyone has had a chance to review the series.
BR,
Osama
Luca Ceresoli
AppliedQuoted 9 lines · Osama Abdelkader
This series converts straightforward DRM panel drivers to the managed MIPI DSI attach and panel add helpers, dropping the corresponding manual detach/remove calls from remove paths. Split by driver family/vendor to keep the changes reviewable.
Patches 2, 4 and 5 of v4 (Samsung, Himax/Ilitek and display vendor panels) are already in drm-misc-next and are not resent here.
[...]
Applied, thanks!
[1/3] drm/panel: Use devm_mipi_dsi_attach in BOE panels
commit: f872d4e3a2ae6bdd8d88a4c19844b3ec851f2549
[2/3] drm/panel: Use managed helpers in Novatek and Raydium panels
commit: 9ebe0565cf49ddaaefe136a0513ce31b7bf01c2c
[3/3] drm/panel: Use managed helpers in assorted panels
commit: 525b076e340a9d37abaa1d34141669f96307698dBest regards,
Signature · 3 lines
Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com