From: Osama Abdelkader <osama.abdelkader@gmail.com>
To: luca.ceresoli@bootlin.com,
Neil Armstrong <neil.armstrong@linaro.org>,
Jessica Zhang <jesszhan0024@gmail.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Ondrej Jirman <megi@xff.cz>,
Javier Martinez Canillas <javierm@redhat.com>,
Michael Trimarchi <michael@amarulasolutions.com>,
Michael Walle <mwalle@kernel.org>,
Dario Binacchi <dario.binacchi@amarulasolutions.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Cc: Osama Abdelkader <osama.abdelkader@gmail.com>
Subject: [PATCH v4 4/6] drm/panel: Use managed helpers in Himax and Ilitek panels
Date: Wed, 12 Aug 2026 17:09:59 +0200 [thread overview]
Message-ID: <20260812151000.74799-1-osama.abdelkader@gmail.com> (raw)
Use the managed MIPI DSI attach and panel add helpers in Himax and Ilitek
panel drivers and drop the corresponding manual detach and panel remove
calls from remove paths.
Suggested-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
---
v4:
- use devm_drm_panel_add instead of drm_panel_add.
drivers/gpu/drm/panel/panel-himax-hx83102.c | 24 ++---------------
drivers/gpu/drm/panel/panel-himax-hx83112a.c | 24 ++++-------------
drivers/gpu/drm/panel/panel-himax-hx83112b.c | 23 ++++------------
drivers/gpu/drm/panel/panel-himax-hx8394.c | 26 +++++--------------
drivers/gpu/drm/panel/panel-ilitek-ili9805.c | 21 +++------------
.../drm/panel/panel-ilitek-ili9806e-core.c | 12 +--------
.../drm/panel/panel-ilitek-ili9806e-core.h | 1 -
.../gpu/drm/panel/panel-ilitek-ili9806e-dsi.c | 16 +-----------
.../gpu/drm/panel/panel-ilitek-ili9806e-spi.c | 6 -----
drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 15 +++--------
drivers/gpu/drm/panel/panel-ilitek-ili9882t.c | 24 ++---------------
11 files changed, 30 insertions(+), 162 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-himax-hx83102.c b/drivers/gpu/drm/panel/panel-himax-hx83102.c
index 6a0851ccf9bb..3ef052571ce0 100644
--- a/drivers/gpu/drm/panel/panel-himax-hx83102.c
+++ b/drivers/gpu/drm/panel/panel-himax-hx83102.c
@@ -1284,9 +1284,7 @@ static int hx83102_panel_add(struct hx83102 *ctx)
ctx->base.funcs = &hx83102_drm_funcs;
ctx->base.dev = &ctx->dsi->dev;
- drm_panel_add(&ctx->base);
-
- return 0;
+ return devm_drm_panel_add(dev, &ctx->base);
}
static int hx83102_probe(struct mipi_dsi_device *dsi)
@@ -1318,24 +1316,7 @@ static int hx83102_probe(struct mipi_dsi_device *dsi)
mipi_dsi_set_drvdata(dsi, ctx);
- ret = mipi_dsi_attach(dsi);
- if (ret)
- drm_panel_remove(&ctx->base);
-
- return ret;
-}
-
-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);
+ return devm_mipi_dsi_attach(&dsi->dev, dsi);
}
static const struct of_device_id hx83102_of_match[] = {
@@ -1369,7 +1350,6 @@ MODULE_DEVICE_TABLE(of, hx83102_of_match);
static struct mipi_dsi_driver hx83102_driver = {
.probe = hx83102_probe,
- .remove = hx83102_remove,
.driver = {
.name = "panel-himax-hx83102",
.of_match_table = hx83102_of_match,
diff --git a/drivers/gpu/drm/panel/panel-himax-hx83112a.c b/drivers/gpu/drm/panel/panel-himax-hx83112a.c
index 142cb1cc067a..36ebfad7a3e9 100644
--- a/drivers/gpu/drm/panel/panel-himax-hx83112a.c
+++ b/drivers/gpu/drm/panel/panel-himax-hx83112a.c
@@ -303,28 +303,15 @@ static int hx83112a_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 = mipi_dsi_attach(dsi);
- if (ret < 0) {
- dev_err_probe(dev, ret, "Failed to attach to DSI host\n");
- drm_panel_remove(&ctx->panel);
+ ret = devm_drm_panel_add(dev, &ctx->panel);
+ if (ret)
return ret;
- }
- return 0;
-}
-
-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);
+ ret = devm_mipi_dsi_attach(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(&ctx->panel);
+ return 0;
}
static const struct of_device_id hx83112a_of_match[] = {
@@ -335,7 +322,6 @@ MODULE_DEVICE_TABLE(of, hx83112a_of_match);
static struct mipi_dsi_driver hx83112a_driver = {
.probe = hx83112a_probe,
- .remove = hx83112a_remove,
.driver = {
.name = "panel-himax-hx83112a",
.of_match_table = hx83112a_of_match,
diff --git a/drivers/gpu/drm/panel/panel-himax-hx83112b.c b/drivers/gpu/drm/panel/panel-himax-hx83112b.c
index 41f21f8c1373..569ed2dec87c 100644
--- a/drivers/gpu/drm/panel/panel-himax-hx83112b.c
+++ b/drivers/gpu/drm/panel/panel-himax-hx83112b.c
@@ -386,29 +386,17 @@ static int hx83112b_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 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);
-}
-
static const struct of_device_id hx83112b_of_match[] = {
{ .compatible = "djn,98-03057-6598b-i" },
{ /* sentinel */ }
@@ -417,7 +405,6 @@ MODULE_DEVICE_TABLE(of, hx83112b_of_match);
static struct mipi_dsi_driver hx83112b_driver = {
.probe = hx83112b_probe,
- .remove = hx83112b_remove,
.driver = {
.name = "panel-himax-hx83112b",
.of_match_table = hx83112b_of_match,
diff --git a/drivers/gpu/drm/panel/panel-himax-hx8394.c b/drivers/gpu/drm/panel/panel-himax-hx8394.c
index 09124610fdc8..4180d4aadf5e 100644
--- a/drivers/gpu/drm/panel/panel-himax-hx8394.c
+++ b/drivers/gpu/drm/panel/panel-himax-hx8394.c
@@ -1023,14 +1023,13 @@ static int hx8394_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) {
- dev_err_probe(dev, ret, "mipi_dsi_attach failed\n");
- drm_panel_remove(&ctx->panel);
+ ret = devm_drm_panel_add(dev, &ctx->panel);
+ if (ret)
return ret;
- }
+
+ ret = devm_mipi_dsi_attach(dev, dsi);
+ if (ret < 0)
+ return dev_err_probe(dev, ret, "mipi_dsi_attach failed\n");
dev_dbg(dev, "%ux%u@%u %ubpp dsi %udl - ready\n",
ctx->desc->mode->hdisplay, ctx->desc->mode->vdisplay,
@@ -1040,18 +1039,6 @@ static int hx8394_probe(struct mipi_dsi_device *dsi)
return 0;
}
-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);
-}
-
static const struct of_device_id hx8394_of_match[] = {
{ .compatible = "hannstar,hsd060bhw4", .data = &hsd060bhw4_desc },
{ .compatible = "huiling,hl055fhav028c", .data = &hl055fhav028c_desc },
@@ -1065,7 +1052,6 @@ MODULE_DEVICE_TABLE(of, hx8394_of_match);
static struct mipi_dsi_driver hx8394_driver = {
.probe = hx8394_probe,
- .remove = hx8394_remove,
.driver = {
.name = DRV_NAME,
.of_match_table = hx8394_of_match,
diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9805.c b/drivers/gpu/drm/panel/panel-ilitek-ili9805.c
index 5610a225f77b..976305991b7f 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9805.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9805.c
@@ -305,31 +305,19 @@ static int ili9805_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;
- 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);
return ret;
}
return 0;
}
-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);
-}
-
static const struct ili9805_desc gpm1780a0_desc = {
.init = gpm1780a0_init,
.mode = &gpm1780a0_timing,
@@ -353,7 +341,6 @@ MODULE_DEVICE_TABLE(of, ili9805_of_match);
static struct mipi_dsi_driver ili9805_dsi_driver = {
.probe = ili9805_dsi_probe,
- .remove = ili9805_dsi_remove,
.driver = {
.name = "ili9805-dsi",
.of_match_table = ili9805_of_match,
diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9806e-core.c b/drivers/gpu/drm/panel/panel-ilitek-ili9806e-core.c
index 53e25d1086db..81d48c402aec 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9806e-core.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9806e-core.c
@@ -112,21 +112,11 @@ int ili9806e_probe(struct device *dev, void *transport,
if (set_prepare_prev_first)
ctx->panel.prepare_prev_first = true;
- drm_panel_add(&ctx->panel);
-
- return 0;
+ return devm_drm_panel_add(dev, &ctx->panel);
}
EXPORT_SYMBOL_GPL(ili9806e_probe);
-void ili9806e_remove(struct device *dev)
-{
- struct ili9806e *ctx = dev_get_drvdata(dev);
-
- drm_panel_remove(&ctx->panel);
-}
-EXPORT_SYMBOL_GPL(ili9806e_remove);
-
MODULE_AUTHOR("Dario Binacchi <dario.binacchi@amarulasolutions.com>");
MODULE_AUTHOR("Gunnar Dibbern <gunnar.dibbern@lht.dlh.de>");
MODULE_AUTHOR("Michael Walle <mwalle@kernel.org>");
diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9806e-core.h b/drivers/gpu/drm/panel/panel-ilitek-ili9806e-core.h
index dddece62cf42..fded4b6793e7 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9806e-core.h
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9806e-core.h
@@ -10,6 +10,5 @@ int ili9806e_power_on(struct device *dev);
int ili9806e_probe(struct device *dev, void *transport,
const struct drm_panel_funcs *funcs,
int connector_type);
-void ili9806e_remove(struct device *dev);
#endif /* _PANEL_ILITEK_ILI9806E_CORE_H */
diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c b/drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c
index 0fb06c425545..89915d58f69d 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c
@@ -141,20 +141,7 @@ static int ili9806e_dsi_probe(struct mipi_dsi_device *dsi)
if (ret)
return ret;
- ret = mipi_dsi_attach(dsi);
- if (ret < 0) {
- dev_err_probe(dev, ret, "Failed to attach to DSI host\n");
- ili9806e_remove(dev);
- return ret;
- }
-
- return 0;
-}
-
-static void ili9806e_dsi_remove(struct mipi_dsi_device *dsi)
-{
- mipi_dsi_detach(dsi);
- ili9806e_remove(&dsi->dev);
+ return devm_mipi_dsi_attach(dev, dsi);
}
static void com35h3p70ulc_init(struct mipi_dsi_multi_context *ctx)
@@ -490,7 +477,6 @@ static struct mipi_dsi_driver ili9806e_dsi_driver = {
.of_match_table = ili9806e_dsi_of_match,
},
.probe = ili9806e_dsi_probe,
- .remove = ili9806e_dsi_remove,
};
module_mipi_dsi_driver(ili9806e_dsi_driver);
diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9806e-spi.c b/drivers/gpu/drm/panel/panel-ilitek-ili9806e-spi.c
index 9d10b0d28f52..187bcb084dd9 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9806e-spi.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9806e-spi.c
@@ -124,11 +124,6 @@ static int ili9806e_spi_probe(struct spi_device *spi)
DRM_MODE_CONNECTOR_DPI);
}
-static void ili9806e_spi_remove(struct spi_device *spi)
-{
- ili9806e_remove(&spi->dev);
-}
-
static void rk050hr345_ct106a_init(struct ili9806e_spi_panel *ctx)
{
struct mipi_dbi *dbi = &ctx->dbi;
@@ -313,7 +308,6 @@ static struct spi_driver ili9806e_spi_driver = {
.of_match_table = ili9806e_spi_of_match,
},
.probe = ili9806e_spi_probe,
- .remove = ili9806e_spi_remove,
.id_table = ili9806e_spi_ids,
};
module_spi_driver(ili9806e_spi_driver);
diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
index 3abdd0870e83..aee114a40cfd 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
@@ -2591,21 +2591,15 @@ 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 ret;
dsi->mode_flags = ctx->desc->mode_flags;
dsi->format = MIPI_DSI_FMT_RGB888;
dsi->lanes = ctx->desc->lanes;
- return mipi_dsi_attach(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);
+ return devm_mipi_dsi_attach(&dsi->dev, dsi);
}
static const struct ili9881c_desc lhr050h41_desc = {
@@ -2719,7 +2713,6 @@ MODULE_DEVICE_TABLE(of, ili9881c_of_match);
static struct mipi_dsi_driver ili9881c_dsi_driver = {
.probe = ili9881c_dsi_probe,
- .remove = ili9881c_dsi_remove,
.driver = {
.name = "ili9881c-dsi",
.of_match_table = ili9881c_of_match,
diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c b/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c
index 6d07fe901357..d4b383138488 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c
@@ -809,9 +809,7 @@ static int ili9882t_add(struct ili9882t *ili)
ili->base.funcs = &ili9882t_funcs;
ili->base.dev = &ili->dsi->dev;
- drm_panel_add(&ili->base);
-
- return 0;
+ return devm_drm_panel_add(dev, &ili->base);
}
static int ili9882t_probe(struct mipi_dsi_device *dsi)
@@ -844,24 +842,7 @@ static int ili9882t_probe(struct mipi_dsi_device *dsi)
mipi_dsi_set_drvdata(dsi, ili);
- ret = mipi_dsi_attach(dsi);
- if (ret)
- drm_panel_remove(&ili->base);
-
- return ret;
-}
-
-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);
+ return devm_mipi_dsi_attach(&dsi->dev, dsi);
}
static const struct of_device_id ili9882t_of_match[] = {
@@ -881,7 +862,6 @@ static struct mipi_dsi_driver ili9882t_driver = {
.of_match_table = ili9882t_of_match,
},
.probe = ili9882t_probe,
- .remove = ili9882t_remove,
};
module_mipi_dsi_driver(ili9882t_driver);
--
2.43.0
next reply other threads:[~2026-08-12 15:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-12 15:09 Osama Abdelkader [this message]
2026-08-25 16:09 ` [PATCH v4 4/6] drm/panel: Use managed helpers in Himax and Ilitek panels Luca Ceresoli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260812151000.74799-1-osama.abdelkader@gmail.com \
--to=osama.abdelkader@gmail.com \
--cc=airlied@gmail.com \
--cc=dario.binacchi@amarulasolutions.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=javierm@redhat.com \
--cc=jesszhan0024@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luca.ceresoli@bootlin.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=megi@xff.cz \
--cc=michael@amarulasolutions.com \
--cc=mripard@kernel.org \
--cc=mwalle@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox