[PATCH v4 2/6] drm/panel: Use managed helpers in Samsung panels
From: Osama Abdelkader
Date: Wed Aug 12 2026 - 10:49:34 EST
Use the managed MIPI DSI attach and panel add helpers in Samsung panel
drivers and drop the corresponding manual detach and panel remove calls
from remove paths. Also, switch to devm_backlight_device_register in
s6e3ha2 and s6e63j0x03.
Suggested-by: Luca Ceresoli <luca.ceresoli@xxxxxxxxxxx>
Signed-off-by: Osama Abdelkader <osama.abdelkader@xxxxxxxxx>
---
v4:
- use devm_drm_panel_add instead of drm_panel_add.
- switch to devm_backlight_device_register in s6e3ha2 and s6e63j0x03.
drivers/gpu/drm/panel/panel-samsung-s6d16d0.c | 19 +++---------
drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c | 20 +++---------
drivers/gpu/drm/panel/panel-samsung-s6e3fa7.c | 20 +++---------
drivers/gpu/drm/panel/panel-samsung-s6e3fc2x01.c | 20 +++---------
drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c | 30 ++++--------------
drivers/gpu/drm/panel/panel-samsung-s6e3ha8.c | 20 +++---------
drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c | 31 ++++---------------
drivers/gpu/drm/panel/panel-samsung-s6e63m0-dsi.c | 13 +-------
drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c | 6 ----
drivers/gpu/drm/panel/panel-samsung-s6e63m0.c | 12 +------
drivers/gpu/drm/panel/panel-samsung-s6e63m0.h | 1 -
drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams427ap24.c | 20 +++---------
drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c | 20 +++---------
drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c | 19 +++---------
drivers/gpu/drm/panel/panel-samsung-s6e8fc0-m1906f9.c | 23 +++-----------
drivers/gpu/drm/panel/panel-samsung-sofef00.c | 20 +++---------
16 files changed, 55 insertions(+), 239 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c b/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
index 54a65abf7e89..cdede494e32f 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
@@ -207,21 +207,11 @@ static int s6d16d0_probe(struct mipi_dsi_device *dsi)
return ret;
}
- drm_panel_add(&s6->panel);
-
- ret = mipi_dsi_attach(dsi);
- if (ret < 0)
- drm_panel_remove(&s6->panel);
-
- return ret;
-}
-
-static void s6d16d0_remove(struct mipi_dsi_device *dsi)
-{
- struct s6d16d0 *s6 = mipi_dsi_get_drvdata(dsi);
+ ret = devm_drm_panel_add(dev, &s6->panel);
+ if (ret)
+ return ret;
- mipi_dsi_detach(dsi);
- drm_panel_remove(&s6->panel);
+ return devm_mipi_dsi_attach(dev, dsi);
}
static const struct of_device_id s6d16d0_of_match[] = {
@@ -232,7 +222,6 @@ MODULE_DEVICE_TABLE(of, s6d16d0_of_match);
static struct mipi_dsi_driver s6d16d0_driver = {
.probe = s6d16d0_probe,
- .remove = s6d16d0_remove,
.driver = {
.name = "panel-samsung-s6d16d0",
.of_match_table = s6d16d0_of_match,
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c b/drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c
index 692020081524..5a4cfb21e2fd 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c
@@ -436,30 +436,19 @@ static int s6d7aa0_probe(struct mipi_dsi_device *dsi)
"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 s6d7aa0_remove(struct mipi_dsi_device *dsi)
-{
- struct s6d7aa0 *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 s6d7aa0_of_match[] = {
{
.compatible = "samsung,lsl080al02",
@@ -479,7 +468,6 @@ MODULE_DEVICE_TABLE(of, s6d7aa0_of_match);
static struct mipi_dsi_driver s6d7aa0_driver = {
.probe = s6d7aa0_probe,
- .remove = s6d7aa0_remove,
.driver = {
.name = "panel-samsung-s6d7aa0",
.of_match_table = s6d7aa0_of_match,
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e3fa7.c b/drivers/gpu/drm/panel/panel-samsung-s6e3fa7.c
index f4d75eca3cdf..9cd92d7a823b 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e3fa7.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e3fa7.c
@@ -211,30 +211,19 @@ static int s6e3fa7_panel_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 s6e3fa7_panel_remove(struct mipi_dsi_device *dsi)
-{
- struct s6e3fa7_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 s6e3fa7_panel_of_match[] = {
{ .compatible = "samsung,s6e3fa7-ams559nk06" },
{ /* sentinel */ }
@@ -243,7 +232,6 @@ MODULE_DEVICE_TABLE(of, s6e3fa7_panel_of_match);
static struct mipi_dsi_driver s6e3fa7_panel_driver = {
.probe = s6e3fa7_panel_probe,
- .remove = s6e3fa7_panel_remove,
.driver = {
.name = "panel-samsung-s6e3fa7",
.of_match_table = s6e3fa7_panel_of_match,
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e3fc2x01.c b/drivers/gpu/drm/panel/panel-samsung-s6e3fc2x01.c
index e63080204af7..8dfe654f36ec 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e3fc2x01.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e3fc2x01.c
@@ -340,30 +340,19 @@ static int s6e3fc2x01_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 s6e3fc2x01_remove(struct mipi_dsi_device *dsi)
-{
- struct samsung_s6e3fc2x01 *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 s6e3fc2x01_of_match[] = {
{ .compatible = "samsung,s6e3fc2x01-ams641rw", .data = &ams641rw_mode },
{ /* sentinel */ }
@@ -372,7 +361,6 @@ MODULE_DEVICE_TABLE(of, s6e3fc2x01_of_match);
static struct mipi_dsi_driver s6e3fc2x01_driver = {
.probe = s6e3fc2x01_probe,
- .remove = s6e3fc2x01_remove,
.driver = {
.name = "panel-samsung-s6e3fc2x01",
.of_match_table = s6e3fc2x01_of_match,
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c b/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
index 1db0c63b1131..cede897ff69d 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
@@ -722,8 +722,8 @@ static int s6e3ha2_probe(struct mipi_dsi_device *dsi)
return PTR_ERR(ctx->enable_gpio);
}
- ctx->bl_dev = backlight_device_register("s6e3ha2", dev, ctx,
- &s6e3ha2_bl_ops, NULL);
+ ctx->bl_dev = devm_backlight_device_register(dev, "s6e3ha2", dev, ctx,
+ &s6e3ha2_bl_ops, NULL);
if (IS_ERR(ctx->bl_dev)) {
dev_err(dev, "failed to register backlight device\n");
return PTR_ERR(ctx->bl_dev);
@@ -735,28 +735,11 @@ static int s6e3ha2_probe(struct mipi_dsi_device *dsi)
ctx->panel.prepare_prev_first = true;
- drm_panel_add(&ctx->panel);
-
- ret = mipi_dsi_attach(dsi);
- if (ret < 0)
- goto remove_panel;
-
- return ret;
-
-remove_panel:
- drm_panel_remove(&ctx->panel);
- backlight_device_unregister(ctx->bl_dev);
-
- return ret;
-}
-
-static void s6e3ha2_remove(struct mipi_dsi_device *dsi)
-{
- struct s6e3ha2 *ctx = mipi_dsi_get_drvdata(dsi);
+ ret = devm_drm_panel_add(dev, &ctx->panel);
+ if (ret)
+ return ret;
- mipi_dsi_detach(dsi);
- drm_panel_remove(&ctx->panel);
- backlight_device_unregister(ctx->bl_dev);
+ return devm_mipi_dsi_attach(dev, dsi);
}
static const struct of_device_id s6e3ha2_of_match[] = {
@@ -768,7 +751,6 @@ MODULE_DEVICE_TABLE(of, s6e3ha2_of_match);
static struct mipi_dsi_driver s6e3ha2_driver = {
.probe = s6e3ha2_probe,
- .remove = s6e3ha2_remove,
.driver = {
.name = "panel-samsung-s6e3ha2",
.of_match_table = s6e3ha2_of_match,
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e3ha8.c b/drivers/gpu/drm/panel/panel-samsung-s6e3ha8.c
index 550e9ef9bb71..c09ff71b9c39 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e3ha8.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e3ha8.c
@@ -283,7 +283,9 @@ static int s6e3ha8_amb577px01_wqhd_probe(struct mipi_dsi_device *dsi)
priv->panel.prepare_prev_first = true;
- drm_panel_add(&priv->panel);
+ ret = devm_drm_panel_add(dev, &priv->panel);
+ if (ret)
+ return ret;
/* This panel only supports DSC; unconditionally enable it */
dsi->dsc = &priv->dsc;
@@ -299,28 +301,15 @@ static int s6e3ha8_amb577px01_wqhd_probe(struct mipi_dsi_device *dsi)
priv->dsc.bits_per_pixel = 8 << 4; /* 4 fractional bits */
priv->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(&priv->panel);
return ret;
}
return 0;
}
-static void s6e3ha8_amb577px01_wqhd_remove(struct mipi_dsi_device *dsi)
-{
- struct s6e3ha8 *priv = 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(&priv->panel);
-}
-
static const struct of_device_id s6e3ha8_amb577px01_wqhd_of_match[] = {
{ .compatible = "samsung,s6e3ha8" },
{ /* sentinel */ }
@@ -329,7 +318,6 @@ MODULE_DEVICE_TABLE(of, s6e3ha8_amb577px01_wqhd_of_match);
static struct mipi_dsi_driver s6e3ha8_amb577px01_wqhd_driver = {
.probe = s6e3ha8_amb577px01_wqhd_probe,
- .remove = s6e3ha8_amb577px01_wqhd_remove,
.driver = {
.name = "panel-s6e3ha8",
.of_match_table = s6e3ha8_amb577px01_wqhd_of_match,
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c b/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c
index e05199ce14ee..1f825d995686 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c
@@ -465,8 +465,8 @@ static int s6e63j0x03_probe(struct mipi_dsi_device *dsi)
ctx->panel.prepare_prev_first = true;
- ctx->bl_dev = backlight_device_register("s6e63j0x03", dev, ctx,
- &s6e63j0x03_bl_ops, NULL);
+ ctx->bl_dev = devm_backlight_device_register(dev, "s6e63j0x03", dev, ctx,
+ &s6e63j0x03_bl_ops, NULL);
if (IS_ERR(ctx->bl_dev))
return dev_err_probe(dev, PTR_ERR(ctx->bl_dev),
"failed to register backlight device\n");
@@ -475,29 +475,11 @@ static int s6e63j0x03_probe(struct mipi_dsi_device *dsi)
ctx->bl_dev->props.brightness = DEFAULT_BRIGHTNESS;
ctx->bl_dev->props.power = BACKLIGHT_POWER_OFF;
- drm_panel_add(&ctx->panel);
-
- ret = mipi_dsi_attach(dsi);
- if (ret < 0)
- goto remove_panel;
-
- return ret;
-
-remove_panel:
- drm_panel_remove(&ctx->panel);
- backlight_device_unregister(ctx->bl_dev);
-
- return ret;
-}
-
-static void s6e63j0x03_remove(struct mipi_dsi_device *dsi)
-{
- struct s6e63j0x03 *ctx = mipi_dsi_get_drvdata(dsi);
-
- mipi_dsi_detach(dsi);
- drm_panel_remove(&ctx->panel);
+ ret = devm_drm_panel_add(dev, &ctx->panel);
+ if (ret)
+ return ret;
- backlight_device_unregister(ctx->bl_dev);
+ return devm_mipi_dsi_attach(dev, dsi);
}
static const struct of_device_id s6e63j0x03_of_match[] = {
@@ -508,7 +490,6 @@ MODULE_DEVICE_TABLE(of, s6e63j0x03_of_match);
static struct mipi_dsi_driver s6e63j0x03_driver = {
.probe = s6e63j0x03_probe,
- .remove = s6e63j0x03_remove,
.driver = {
.name = "panel_samsung_s6e63j0x03",
.of_match_table = s6e63j0x03_of_match,
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0-dsi.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0-dsi.c
index 2630975c111b..c3842449c895 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0-dsi.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0-dsi.c
@@ -105,17 +105,7 @@ static int s6e63m0_dsi_probe(struct mipi_dsi_device *dsi)
if (ret)
return ret;
- ret = mipi_dsi_attach(dsi);
- if (ret < 0)
- s6e63m0_remove(dev);
-
- return ret;
-}
-
-static void s6e63m0_dsi_remove(struct mipi_dsi_device *dsi)
-{
- mipi_dsi_detach(dsi);
- s6e63m0_remove(&dsi->dev);
+ return devm_mipi_dsi_attach(dev, dsi);
}
static const struct of_device_id s6e63m0_dsi_of_match[] = {
@@ -126,7 +116,6 @@ MODULE_DEVICE_TABLE(of, s6e63m0_dsi_of_match);
static struct mipi_dsi_driver s6e63m0_dsi_driver = {
.probe = s6e63m0_dsi_probe,
- .remove = s6e63m0_dsi_remove,
.driver = {
.name = "panel-samsung-s6e63m0",
.of_match_table = s6e63m0_dsi_of_match,
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c
index d99afcc672ca..c8bec2b1e7c1 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c
@@ -62,11 +62,6 @@ static int s6e63m0_spi_probe(struct spi_device *spi)
s6e63m0_spi_dcs_write, false);
}
-static void s6e63m0_spi_remove(struct spi_device *spi)
-{
- s6e63m0_remove(&spi->dev);
-}
-
static const struct of_device_id s6e63m0_spi_of_match[] = {
{ .compatible = "samsung,s6e63m0" },
{ /* sentinel */ }
@@ -75,7 +70,6 @@ MODULE_DEVICE_TABLE(of, s6e63m0_spi_of_match);
static struct spi_driver s6e63m0_spi_driver = {
.probe = s6e63m0_spi_probe,
- .remove = s6e63m0_spi_remove,
.driver = {
.name = "panel-samsung-s6e63m0",
.of_match_table = s6e63m0_spi_of_match,
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
index 997115b1e541..1990a7c23219 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
@@ -720,20 +720,10 @@ int s6e63m0_probe(struct device *dev, void *trsp,
if (ret < 0)
return ret;
- drm_panel_add(&ctx->panel);
-
- return 0;
+ return devm_drm_panel_add(dev, &ctx->panel);
}
EXPORT_SYMBOL_GPL(s6e63m0_probe);
-void s6e63m0_remove(struct device *dev)
-{
- struct s6e63m0 *ctx = dev_get_drvdata(dev);
-
- drm_panel_remove(&ctx->panel);
-}
-EXPORT_SYMBOL_GPL(s6e63m0_remove);
-
MODULE_AUTHOR("Paweł Chmiel <pawel.mikolaj.chmiel@xxxxxxxxx>");
MODULE_DESCRIPTION("s6e63m0 LCD Driver");
MODULE_LICENSE("GPL v2");
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.h b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.h
index c926eca1c817..7dae6772899c 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.h
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.h
@@ -35,6 +35,5 @@ int s6e63m0_probe(struct device *dev, void *trsp,
const u8 *data,
size_t len),
bool dsi_mode);
-void s6e63m0_remove(struct device *dev);
#endif /* _PANEL_SAMSUNG_S6E63M0_H */
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams427ap24.c b/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams427ap24.c
index 77fee36dbb55..b48a2f9578e7 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams427ap24.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams427ap24.c
@@ -722,30 +722,19 @@ static int s6e88a0_ams427ap24_probe(struct mipi_dsi_device *dsi)
if (ret < 0)
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, "Failed to attach to DSI host: %d\n", ret);
- drm_panel_remove(&ctx->panel);
return ret;
}
return 0;
}
-static void s6e88a0_ams427ap24_remove(struct mipi_dsi_device *dsi)
-{
- struct s6e88a0_ams427ap24 *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 s6e88a0_ams427ap24_of_match[] = {
{ .compatible = "samsung,s6e88a0-ams427ap24" },
{ /* sentinel */ },
@@ -754,7 +743,6 @@ MODULE_DEVICE_TABLE(of, s6e88a0_ams427ap24_of_match);
static struct mipi_dsi_driver s6e88a0_ams427ap24_driver = {
.probe = s6e88a0_ams427ap24_probe,
- .remove = s6e88a0_ams427ap24_remove,
.driver = {
.name = "panel-s6e88a0-ams427ap24",
.of_match_table = s6e88a0_ams427ap24_of_match,
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c b/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c
index ca5cad41ff1d..bbb86ea86d5e 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c
@@ -194,30 +194,19 @@ static int s6e88a0_ams452ef01_probe(struct mipi_dsi_device *dsi)
dsi->format = MIPI_DSI_FMT_RGB888;
dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST;
- 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 s6e88a0_ams452ef01_remove(struct mipi_dsi_device *dsi)
-{
- struct s6e88a0_ams452ef01 *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 s6e88a0_ams452ef01_of_match[] = {
{ .compatible = "samsung,s6e88a0-ams452ef01" },
{ /* sentinel */ },
@@ -226,7 +215,6 @@ MODULE_DEVICE_TABLE(of, s6e88a0_ams452ef01_of_match);
static struct mipi_dsi_driver s6e88a0_ams452ef01_driver = {
.probe = s6e88a0_ams452ef01_probe,
- .remove = s6e88a0_ams452ef01_remove,
.driver = {
.name = "panel-s6e88a0-ams452ef01",
.of_match_table = s6e88a0_ams452ef01_of_match,
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c b/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
index 1b5c500d4f4e..8f160ca0a94e 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
@@ -1018,21 +1018,11 @@ static int s6e8aa0_probe(struct mipi_dsi_device *dsi)
ctx->panel.prepare_prev_first = true;
- drm_panel_add(&ctx->panel);
-
- ret = mipi_dsi_attach(dsi);
- if (ret < 0)
- drm_panel_remove(&ctx->panel);
-
- return ret;
-}
-
-static void s6e8aa0_remove(struct mipi_dsi_device *dsi)
-{
- struct s6e8aa0 *ctx = mipi_dsi_get_drvdata(dsi);
+ ret = devm_drm_panel_add(dev, &ctx->panel);
+ if (ret)
+ return ret;
- mipi_dsi_detach(dsi);
- drm_panel_remove(&ctx->panel);
+ return devm_mipi_dsi_attach(dev, dsi);
}
static const struct of_device_id s6e8aa0_of_match[] = {
@@ -1043,7 +1033,6 @@ MODULE_DEVICE_TABLE(of, s6e8aa0_of_match);
static struct mipi_dsi_driver s6e8aa0_driver = {
.probe = s6e8aa0_probe,
- .remove = s6e8aa0_remove,
.driver = {
.name = "panel-samsung-s6e8aa0",
.of_match_table = s6e8aa0_of_match,
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e8fc0-m1906f9.c b/drivers/gpu/drm/panel/panel-samsung-s6e8fc0-m1906f9.c
index 2fae0dc6c424..0e797a2ec14f 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e8fc0-m1906f9.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e8fc0-m1906f9.c
@@ -256,29 +256,17 @@ static int s6e8fc0_m1906f9_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 s6e8fc0_remove(struct mipi_dsi_device *dsi)
-{
- struct s6e8fc0_ctx *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 samsung_s6e8fc0_of_match[] = {
{ .compatible = "samsung,s6e8fc0-m1906f9" },
{ /* sentinel */ }
@@ -287,7 +275,6 @@ MODULE_DEVICE_TABLE(of, samsung_s6e8fc0_of_match);
static struct mipi_dsi_driver s6e8fc0_driver = {
.probe = s6e8fc0_m1906f9_probe,
- .remove = s6e8fc0_remove,
.driver = {
.name = "panel-samsung-s6e8fc0-m1906f9",
.of_match_table = samsung_s6e8fc0_of_match,
diff --git a/drivers/gpu/drm/panel/panel-samsung-sofef00.c b/drivers/gpu/drm/panel/panel-samsung-sofef00.c
index f07d6533ed69..da02955f5f42 100644
--- a/drivers/gpu/drm/panel/panel-samsung-sofef00.c
+++ b/drivers/gpu/drm/panel/panel-samsung-sofef00.c
@@ -250,30 +250,19 @@ static int sofef00_panel_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 sofef00_panel_remove(struct mipi_dsi_device *dsi)
-{
- struct sofef00_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 sofef00_panel_of_match[] = {
{ .compatible = "samsung,sofef00" }, /* legacy */
{ .compatible = "samsung,sofef00-ams628nw01" },
@@ -283,7 +272,6 @@ MODULE_DEVICE_TABLE(of, sofef00_panel_of_match);
static struct mipi_dsi_driver sofef00_panel_driver = {
.probe = sofef00_panel_probe,
- .remove = sofef00_panel_remove,
.driver = {
.name = "panel-samsung-sofef00",
.of_match_table = sofef00_panel_of_match,
--
2.43.0