[PATCH v2 4/6] drm/panel: Use devm_mipi_dsi_attach in Himax and Ilitek panels

From: Osama Abdelkader

Date: Tue Aug 11 2026 - 12:55:44 EST


Use the managed MIPI DSI attach helper in Himax and Ilitek panel drivers
and drop the corresponding manual detach calls from remove paths.

Signed-off-by: Osama Abdelkader <osama.abdelkader@xxxxxxxxx>

v2:
- break long description lines.
- add Signed-off-by tag
---
drivers/gpu/drm/panel/panel-himax-hx83102.c | 7 +------
drivers/gpu/drm/panel/panel-himax-hx83112a.c | 8 +-------
drivers/gpu/drm/panel/panel-himax-hx83112b.c | 8 +-------
drivers/gpu/drm/panel/panel-himax-hx8394.c | 8 +-------
drivers/gpu/drm/panel/panel-ilitek-ili9805.c | 9 +--------
drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c | 3 +--
drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 4 +---
drivers/gpu/drm/panel/panel-ilitek-ili9882t.c | 7 +------
8 files changed, 8 insertions(+), 46 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-himax-hx83102.c b/drivers/gpu/drm/panel/panel-himax-hx83102.c
index 6a0851ccf9bb..4a28541891a6 100644
--- a/drivers/gpu/drm/panel/panel-himax-hx83102.c
+++ b/drivers/gpu/drm/panel/panel-himax-hx83102.c
@@ -1318,7 +1318,7 @@ static int hx83102_probe(struct mipi_dsi_device *dsi)

mipi_dsi_set_drvdata(dsi, ctx);

- ret = mipi_dsi_attach(dsi);
+ ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
if (ret)
drm_panel_remove(&ctx->base);

@@ -1328,11 +1328,6 @@ static int hx83102_probe(struct mipi_dsi_device *dsi)
static void hx83102_remove(struct mipi_dsi_device *dsi)
{
struct hx83102 *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);

if (ctx->base.dev)
drm_panel_remove(&ctx->base);
diff --git a/drivers/gpu/drm/panel/panel-himax-hx83112a.c b/drivers/gpu/drm/panel/panel-himax-hx83112a.c
index 142cb1cc067a..bcd665b7ff88 100644
--- a/drivers/gpu/drm/panel/panel-himax-hx83112a.c
+++ b/drivers/gpu/drm/panel/panel-himax-hx83112a.c
@@ -305,7 +305,7 @@ static int hx83112a_probe(struct mipi_dsi_device *dsi)

drm_panel_add(&ctx->panel);

- ret = mipi_dsi_attach(dsi);
+ ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
if (ret < 0) {
dev_err_probe(dev, ret, "Failed to attach to DSI host\n");
drm_panel_remove(&ctx->panel);
@@ -318,12 +318,6 @@ static int hx83112a_probe(struct mipi_dsi_device *dsi)
static void hx83112a_remove(struct mipi_dsi_device *dsi)
{
struct hx83112a_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);
}

diff --git a/drivers/gpu/drm/panel/panel-himax-hx83112b.c b/drivers/gpu/drm/panel/panel-himax-hx83112b.c
index 41f21f8c1373..1ea5a9dc3ac5 100644
--- a/drivers/gpu/drm/panel/panel-himax-hx83112b.c
+++ b/drivers/gpu/drm/panel/panel-himax-hx83112b.c
@@ -388,7 +388,7 @@ static int hx83112b_probe(struct mipi_dsi_device *dsi)

drm_panel_add(&ctx->panel);

- ret = mipi_dsi_attach(dsi);
+ ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
if (ret < 0) {
drm_panel_remove(&ctx->panel);
return dev_err_probe(dev, ret, "Failed to attach to DSI host\n");
@@ -400,12 +400,6 @@ static int hx83112b_probe(struct mipi_dsi_device *dsi)
static void hx83112b_remove(struct mipi_dsi_device *dsi)
{
struct hx83112b_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);
}

diff --git a/drivers/gpu/drm/panel/panel-himax-hx8394.c b/drivers/gpu/drm/panel/panel-himax-hx8394.c
index 09124610fdc8..7fc7063862c0 100644
--- a/drivers/gpu/drm/panel/panel-himax-hx8394.c
+++ b/drivers/gpu/drm/panel/panel-himax-hx8394.c
@@ -1025,7 +1025,7 @@ static int hx8394_probe(struct mipi_dsi_device *dsi)

drm_panel_add(&ctx->panel);

- ret = mipi_dsi_attach(dsi);
+ ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
if (ret < 0) {
dev_err_probe(dev, ret, "mipi_dsi_attach failed\n");
drm_panel_remove(&ctx->panel);
@@ -1043,12 +1043,6 @@ static int hx8394_probe(struct mipi_dsi_device *dsi)
static void hx8394_remove(struct mipi_dsi_device *dsi)
{
struct hx8394 *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);
}

diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9805.c b/drivers/gpu/drm/panel/panel-ilitek-ili9805.c
index 5610a225f77b..aadb13eb41e0 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9805.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9805.c
@@ -307,7 +307,7 @@ static int ili9805_dsi_probe(struct mipi_dsi_device *dsi)

drm_panel_add(&ctx->panel);

- ret = mipi_dsi_attach(dsi);
+ ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
if (ret < 0) {
dev_err(&dsi->dev, "mipi_dsi_attach failed: %d\n", ret);
drm_panel_remove(&ctx->panel);
@@ -320,13 +320,6 @@ static int ili9805_dsi_probe(struct mipi_dsi_device *dsi)
static void ili9805_dsi_remove(struct mipi_dsi_device *dsi)
{
struct ili9805 *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);
}

diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c b/drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c
index 0fb06c425545..a03a1b4411ad 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c
@@ -141,7 +141,7 @@ static int ili9806e_dsi_probe(struct mipi_dsi_device *dsi)
if (ret)
return ret;

- ret = mipi_dsi_attach(dsi);
+ ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
if (ret < 0) {
dev_err_probe(dev, ret, "Failed to attach to DSI host\n");
ili9806e_remove(dev);
@@ -153,7 +153,6 @@ static int ili9806e_dsi_probe(struct mipi_dsi_device *dsi)

static void ili9806e_dsi_remove(struct mipi_dsi_device *dsi)
{
- mipi_dsi_detach(dsi);
ili9806e_remove(&dsi->dev);
}

diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
index 3abdd0870e83..ca7037a4242c 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
@@ -2597,14 +2597,12 @@ static int ili9881c_dsi_probe(struct mipi_dsi_device *dsi)
dsi->format = MIPI_DSI_FMT_RGB888;
dsi->lanes = ctx->desc->lanes;

- return mipi_dsi_attach(dsi);
+ return devm_mipi_dsi_attach(&dsi->dev, 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);
}

diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c b/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c
index 6d07fe901357..896de9460aa8 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c
@@ -844,7 +844,7 @@ static int ili9882t_probe(struct mipi_dsi_device *dsi)

mipi_dsi_set_drvdata(dsi, ili);

- ret = mipi_dsi_attach(dsi);
+ ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
if (ret)
drm_panel_remove(&ili->base);

@@ -854,11 +854,6 @@ static int ili9882t_probe(struct mipi_dsi_device *dsi)
static void ili9882t_remove(struct mipi_dsi_device *dsi)
{
struct ili9882t *ili = 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 (ili->base.dev)
drm_panel_remove(&ili->base);
--
2.43.0