drm/panel: switch panel registration to devm_drm_panel_add()
Subsystems (4)
v2 cover drm/panel: switch panel registration to devm_drm_panel_add()
This respins the previous attach-failure fixes as a single series.
drm-misc-next now has devm_drm_panel_add() in commit e43a8e3ad8fa ("drm/panel: add devm_drm_panel_add() helper"), so convert the three affected panel drivers to the managed helper instead of open-coding drm_panel_remove() in their failure and remove paths.
Changes in v2:
- group the three related panel fixes into one series
- rebase onto drm-misc-next and use devm_drm_panel_add()
- drop manual drm_panel_remove() handling from probe/remove
Myeonghun Pak (3):
drm/panel: ilitek-ili9881c: use devm_drm_panel_add() drm/panel: jdi-fhd-r63452: use devm_drm_panel_add() drm/panel: lg-sw43408: use devm_drm_panel_add()
drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 7 +++---- drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c | 7 +++---- drivers/gpu/drm/panel/panel-lg-sw43408.c | 10 +++++----- 3 files changed, 11 insertions(+), 13 deletions(-)
Signature · 1 line
2.47.1
PATCH v2 1/3 drm/panel: ilitek-ili9881c: use devm_drm_panel_add()
Replace drm_panel_add()/drm_panel_remove() with devm_drm_panel_add() now that drm-misc-next provides it. This keeps panel deregistration tied to the device lifetime and removes the manual cleanup from the remove callback.
--- drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/panel/panel-ilitek-ili9881c.c +3 -4
@@ -2590,7 +2590,9 @@ static int ili9881c_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 dev_err_probe (&dsi->dev, ret,"Failed to add panel\n" ); dsi->mode_flags = ctx->desc->mode_flags; dsi->format =MIPI_DSI_FMT_RGB888 ;
@@ -2601,10 +2603,7 @@ static int ili9881c_dsi_probe(struct mipi_dsi_device *dsi)static void ili9881c_dsi_remove (struct mipi_dsi_device *dsi) { -struct ili9881c *ctx =mipi_dsi_get_drvdata (dsi); -mipi_dsi_detach (dsi); -drm_panel_remove (&ctx->panel); }static const struct ili9881c_desc lhr050h41_desc = {
Signature · 1 line
2.47.1
PATCH v2 2/3 drm/panel: jdi-fhd-r63452: use devm_drm_panel_add()
In reply to Myeonghun PakReplace drm_panel_add()/drm_panel_remove() with devm_drm_panel_add() now that drm-misc-next provides it. This keeps panel deregistration tied to the device lifetime and removes the manual cleanup from the remove callback.
--- drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c +3 -4
@@ -200,7 +200,9 @@ 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 dev_err_probe (dev, ret,"Failed to add panel\n" ); ret =mipi_dsi_attach (dsi);if (ret <0 ) {
@@ -213,14 +215,11 @@ static int jdi_fhd_r63452_probe(struct mipi_dsi_device *dsi)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[] = {
Signature · 1 line
2.47.1
PATCH v2 3/3 drm/panel: lg-sw43408: use devm_drm_panel_add()
In reply to Myeonghun PakReplace drm_panel_add()/drm_panel_remove() with devm_drm_panel_add() now that drm-misc-next provides it. This keeps panel deregistration tied to the device lifetime and removes the manual cleanup from the remove callback.
--- drivers/gpu/drm/panel/panel-lg-sw43408.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/panel/panel-lg-sw43408.c +5 -5
@@ -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 <0 ) +return dev_err_probe (dev, ret,"Failed to add panel\n" ); + +return 0 ; }static int sw43408_probe (struct mipi_dsi_device *dsi)
@@ -299,14 +302,11 @@ static int sw43408_probe(struct mipi_dsi_device *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); }static struct mipi_dsi_driver sw43408_driver = {
Signature · 1 line
2.47.1
Re: [PATCH v2 3/3] drm/panel: lg-sw43408: use devm_drm_panel_add()
Quoted 29 lines · Myeonghun Pak
Replace drm_panel_add()/drm_panel_remove() with
devm_drm_panel_add()now that drm-misc-next provides it. This keeps panel deregistration tied to the device lifetime and removes the manual cleanup from the remove callback.Signed-off-by Myeonghun Pak <[email protected]>--- drivers/gpu/drm/panel/panel-lg-sw43408.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/gpu/drm/panel/panel-lg-sw43408.c +5
-2@@ -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 <0 ) +return dev_err_probe (dev, ret,"Failed to add panel\n" ); + +return 0 ; }static int sw43408_probe (struct mipi_dsi_device *dsi)
drivers/gpu/drm/panel/panel-lg-sw43408.c static int sw43408_probe(struct mipi_dsi_device *dsi) · line 307
Quoted 7 lines
drivers/gpu/drm/panel/panel-lg-sw43408.c +0
-1@@ -299,14 +302,11 @@ static int sw43408_probe(struct mipi_dsi_device *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);
This begs to use devm_mipi_dsi_attach() in the probe function. The whole remove callback can be removed then.
Quoted 10 lines
drivers/gpu/drm/panel/panel-lg-sw43408.c +0
-2if (ret <0 )dev_err (&dsi->dev,"failed to detach from DSI host: %d\n" , ret); - -drm_panel_remove (&ctx->base); }static struct mipi_dsi_driver sw43408_driver = {Signature · 1 line
2.47.1
Signature · 2 lines
With best wishes Dmitry
Quoted 13 lines · Myeonghun Pak
This respins the previous attach-failure fixes as a single series.
drm-misc-next now has
devm_drm_panel_add()in commite43a8e3ad8fa("drm/panel: adddevm_drm_panel_add()helper"), so convert the three affected panel drivers to the managed helper instead of open-codingdrm_panel_remove()in their failure and remove paths.Changes in v2:
- group the three related panel fixes into one series
- rebase onto drm-misc-next and usedevm_drm_panel_add()
- drop manualdrm_panel_remove()handling from probe/removeMyeonghun Pak (3):
Quoted 9 lines
drm/panel: ilitek-ili9881c: use devm_drm_panel_add() drm/panel: jdi-fhd-r63452: use devm_drm_panel_add() drm/panel: lg-sw43408: use devm_drm_panel_add()drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 7 +++---- drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c | 7 +++---- drivers/gpu/drm/panel/panel-lg-sw43408.c | 10 +++++----- 3 files changed, 11 insertions(+), 13 deletions(-)
Thanks,
Neil