* [PATCH v2 01/10] drm/panel/visionox-g2647fb105: Use refcounted allocation in place of devm_kzalloc()
2026-05-08 7:04 [PATCH v2 00/10] drm/panel: Use refcounted allocation for remaining panel drivers Albert Esteve
@ 2026-05-08 7:04 ` Albert Esteve
2026-05-08 7:04 ` [PATCH v2 02/10] drm/panel/samsung-s6e63m0: " Albert Esteve
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Albert Esteve @ 2026-05-08 7:04 UTC (permalink / raw)
To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Michael Tretter,
Michael Walle, Dario Binacchi
Cc: dri-devel, linux-kernel, Albert Esteve
Move to using the new API devm_drm_panel_alloc() to allocate the
panel. In the call to the new API, avoid using explicit type and use
__typeof() for more type safety. Also deduplicate the prepare_prev_first
assignment that was set both before and after drm_panel_init().
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Albert Esteve <aesteve@redhat.com>
---
drivers/gpu/drm/panel/panel-visionox-g2647fb105.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-visionox-g2647fb105.c b/drivers/gpu/drm/panel/panel-visionox-g2647fb105.c
index 413849f7b4dec..d5555a1731575 100644
--- a/drivers/gpu/drm/panel/panel-visionox-g2647fb105.c
+++ b/drivers/gpu/drm/panel/panel-visionox-g2647fb105.c
@@ -207,9 +207,12 @@ static int visionox_g2647fb105_probe(struct mipi_dsi_device *dsi)
struct visionox_g2647fb105 *ctx;
int ret;
- ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
- if (!ctx)
- return -ENOMEM;
+ ctx = devm_drm_panel_alloc(dev, __typeof(*ctx), panel,
+ &visionox_g2647fb105_panel_funcs,
+ DRM_MODE_CONNECTOR_DSI);
+
+ if (IS_ERR(ctx))
+ return PTR_ERR(ctx);
ret = devm_regulator_bulk_get_const(dev,
ARRAY_SIZE(visionox_g2647fb105_supplies),
@@ -233,10 +236,6 @@ static int visionox_g2647fb105_probe(struct mipi_dsi_device *dsi)
ctx->panel.prepare_prev_first = true;
- drm_panel_init(&ctx->panel, dev, &visionox_g2647fb105_panel_funcs,
- DRM_MODE_CONNECTOR_DSI);
- ctx->panel.prepare_prev_first = true;
-
ctx->panel.backlight = visionox_g2647fb105_create_backlight(dsi);
if (IS_ERR(ctx->panel.backlight))
return dev_err_probe(dev, PTR_ERR(ctx->panel.backlight),
--
2.53.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH v2 02/10] drm/panel/samsung-s6e63m0: Use refcounted allocation in place of devm_kzalloc()
2026-05-08 7:04 [PATCH v2 00/10] drm/panel: Use refcounted allocation for remaining panel drivers Albert Esteve
2026-05-08 7:04 ` [PATCH v2 01/10] drm/panel/visionox-g2647fb105: Use refcounted allocation in place of devm_kzalloc() Albert Esteve
@ 2026-05-08 7:04 ` Albert Esteve
2026-05-08 7:04 ` [PATCH v2 03/10] drm/panel/novatek-nt37700f: " Albert Esteve
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Albert Esteve @ 2026-05-08 7:04 UTC (permalink / raw)
To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Michael Tretter,
Michael Walle, Dario Binacchi
Cc: dri-devel, linux-kernel, Albert Esteve
Move to using the new API devm_drm_panel_alloc() to allocate the
panel. In the call to the new API, avoid using explicit type and use
__typeof() for more type safety.
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Albert Esteve <aesteve@redhat.com>
---
drivers/gpu/drm/panel/panel-samsung-s6e63m0.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
index ea241c89593b6..997115b1e541d 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
@@ -677,9 +677,13 @@ int s6e63m0_probe(struct device *dev, void *trsp,
u32 max_brightness;
int ret;
- ctx = devm_kzalloc(dev, sizeof(struct s6e63m0), GFP_KERNEL);
- if (!ctx)
- return -ENOMEM;
+ ctx = devm_drm_panel_alloc(dev, __typeof(*ctx), panel,
+ &s6e63m0_drm_funcs,
+ dsi_mode ? DRM_MODE_CONNECTOR_DSI :
+ DRM_MODE_CONNECTOR_DPI);
+
+ if (IS_ERR(ctx))
+ return PTR_ERR(ctx);
ctx->transport_data = trsp;
ctx->dsi_mode = dsi_mode;
@@ -712,10 +716,6 @@ int s6e63m0_probe(struct device *dev, void *trsp,
return PTR_ERR(ctx->reset_gpio);
}
- drm_panel_init(&ctx->panel, dev, &s6e63m0_drm_funcs,
- dsi_mode ? DRM_MODE_CONNECTOR_DSI :
- DRM_MODE_CONNECTOR_DPI);
-
ret = s6e63m0_backlight_register(ctx, max_brightness);
if (ret < 0)
return ret;
--
2.53.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH v2 03/10] drm/panel/novatek-nt37700f: Use refcounted allocation in place of devm_kzalloc()
2026-05-08 7:04 [PATCH v2 00/10] drm/panel: Use refcounted allocation for remaining panel drivers Albert Esteve
2026-05-08 7:04 ` [PATCH v2 01/10] drm/panel/visionox-g2647fb105: Use refcounted allocation in place of devm_kzalloc() Albert Esteve
2026-05-08 7:04 ` [PATCH v2 02/10] drm/panel/samsung-s6e63m0: " Albert Esteve
@ 2026-05-08 7:04 ` Albert Esteve
2026-05-08 7:04 ` [PATCH v2 04/10] drm/panel/lxd-m9189a: " Albert Esteve
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Albert Esteve @ 2026-05-08 7:04 UTC (permalink / raw)
To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Michael Tretter,
Michael Walle, Dario Binacchi
Cc: dri-devel, linux-kernel, Albert Esteve
Move to using the new API devm_drm_panel_alloc() to allocate the
panel. In the call to the new API, avoid using explicit type and use
__typeof() for more type safety.
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Albert Esteve <aesteve@redhat.com>
---
drivers/gpu/drm/panel/panel-novatek-nt37700f.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-novatek-nt37700f.c b/drivers/gpu/drm/panel/panel-novatek-nt37700f.c
index 74f46a268c0f6..c221dd498fed4 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt37700f.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt37700f.c
@@ -225,9 +225,12 @@ static int nt37700f_tianma_probe(struct mipi_dsi_device *dsi)
struct nt37700f_tianma *ctx;
int ret;
- ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
- if (!ctx)
- return -ENOMEM;
+ ctx = devm_drm_panel_alloc(dev, __typeof(*ctx), panel,
+ &nt37700f_tianma_panel_funcs,
+ DRM_MODE_CONNECTOR_DSI);
+
+ if (IS_ERR(ctx))
+ return PTR_ERR(ctx);
ctx->supply = devm_regulator_get(dev, "power");
if (IS_ERR(ctx->supply))
@@ -247,8 +250,6 @@ static int nt37700f_tianma_probe(struct mipi_dsi_device *dsi)
dsi->mode_flags = MIPI_DSI_MODE_VIDEO_BURST |
MIPI_DSI_CLOCK_NON_CONTINUOUS | MIPI_DSI_MODE_LPM;
- drm_panel_init(&ctx->panel, dev, &nt37700f_tianma_panel_funcs,
- DRM_MODE_CONNECTOR_DSI);
ctx->panel.prepare_prev_first = true;
ctx->panel.backlight = nt37700f_tianma_create_backlight(dsi);
--
2.53.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH v2 04/10] drm/panel/lxd-m9189a: Use refcounted allocation in place of devm_kzalloc()
2026-05-08 7:04 [PATCH v2 00/10] drm/panel: Use refcounted allocation for remaining panel drivers Albert Esteve
` (2 preceding siblings ...)
2026-05-08 7:04 ` [PATCH v2 03/10] drm/panel/novatek-nt37700f: " Albert Esteve
@ 2026-05-08 7:04 ` Albert Esteve
2026-05-08 7:04 ` [PATCH v2 05/10] drm/panel/ilitek-ili9806e: " Albert Esteve
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Albert Esteve @ 2026-05-08 7:04 UTC (permalink / raw)
To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Michael Tretter,
Michael Walle, Dario Binacchi
Cc: dri-devel, linux-kernel, Albert Esteve
Move to using the new API devm_drm_panel_alloc() to allocate the
panel. In the call to the new API, avoid using explicit type and use
__typeof() for more type safety.
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Albert Esteve <aesteve@redhat.com>
---
drivers/gpu/drm/panel/panel-lxd-m9189a.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-lxd-m9189a.c b/drivers/gpu/drm/panel/panel-lxd-m9189a.c
index 68019e1e43a96..baaf170779e03 100644
--- a/drivers/gpu/drm/panel/panel-lxd-m9189a.c
+++ b/drivers/gpu/drm/panel/panel-lxd-m9189a.c
@@ -165,9 +165,12 @@ static int lxd_m9189_probe(struct mipi_dsi_device *dsi)
struct m9189_panel *m9189;
int ret;
- m9189 = devm_kzalloc(dev, sizeof(*m9189), GFP_KERNEL);
- if (!m9189)
- return -ENOMEM;
+ m9189 = devm_drm_panel_alloc(dev, __typeof(*m9189), panel,
+ &m9189_panel_funcs,
+ DRM_MODE_CONNECTOR_DSI);
+
+ if (IS_ERR(m9189))
+ return PTR_ERR(m9189);
m9189->supply = devm_regulator_get(dev, "power");
if (IS_ERR(m9189->supply))
@@ -191,8 +194,6 @@ static int lxd_m9189_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_init(&m9189->panel, dev, &m9189_panel_funcs,
- DRM_MODE_CONNECTOR_DSI);
m9189->panel.prepare_prev_first = true;
ret = drm_panel_of_backlight(&m9189->panel);
--
2.53.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH v2 05/10] drm/panel/ilitek-ili9806e: Use refcounted allocation in place of devm_kzalloc()
2026-05-08 7:04 [PATCH v2 00/10] drm/panel: Use refcounted allocation for remaining panel drivers Albert Esteve
` (3 preceding siblings ...)
2026-05-08 7:04 ` [PATCH v2 04/10] drm/panel/lxd-m9189a: " Albert Esteve
@ 2026-05-08 7:04 ` Albert Esteve
2026-05-08 7:04 ` [PATCH v2 06/10] drm/panel/tdo-tl070wsh30: " Albert Esteve
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Albert Esteve @ 2026-05-08 7:04 UTC (permalink / raw)
To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Michael Tretter,
Michael Walle, Dario Binacchi
Cc: dri-devel, linux-kernel, Albert Esteve
Move to using the new API devm_drm_panel_alloc() to allocate the
panel. In the call to the new API, avoid using explicit type and use
__typeof() for more type safety.
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Albert Esteve <aesteve@redhat.com>
---
drivers/gpu/drm/panel/panel-ilitek-ili9806e-core.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9806e-core.c b/drivers/gpu/drm/panel/panel-ilitek-ili9806e-core.c
index be2cf14401553..53e25d1086db8 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9806e-core.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9806e-core.c
@@ -78,9 +78,11 @@ int ili9806e_probe(struct device *dev, void *transport,
bool set_prepare_prev_first = false;
int ret;
- ctx = devm_kzalloc(dev, sizeof(struct ili9806e), GFP_KERNEL);
- if (!ctx)
- return -ENOMEM;
+ ctx = devm_drm_panel_alloc(dev, __typeof(*ctx), panel,
+ funcs, connector_type);
+
+ if (IS_ERR(ctx))
+ return PTR_ERR(ctx);
dev_set_drvdata(dev, ctx);
ctx->transport = transport;
@@ -103,8 +105,6 @@ int ili9806e_probe(struct device *dev, void *transport,
return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio),
"Failed to get reset-gpios\n");
- drm_panel_init(&ctx->panel, dev, funcs, connector_type);
-
ret = drm_panel_of_backlight(&ctx->panel);
if (ret)
return dev_err_probe(dev, ret, "Failed to get backlight\n");
--
2.53.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH v2 06/10] drm/panel/tdo-tl070wsh30: Use refcounted allocation in place of devm_kzalloc()
2026-05-08 7:04 [PATCH v2 00/10] drm/panel: Use refcounted allocation for remaining panel drivers Albert Esteve
` (4 preceding siblings ...)
2026-05-08 7:04 ` [PATCH v2 05/10] drm/panel/ilitek-ili9806e: " Albert Esteve
@ 2026-05-08 7:04 ` Albert Esteve
2026-05-08 7:04 ` [PATCH v2 07/10] drm/panel/sharp-ls043t1le01: " Albert Esteve
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Albert Esteve @ 2026-05-08 7:04 UTC (permalink / raw)
To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Michael Tretter,
Michael Walle, Dario Binacchi
Cc: dri-devel, linux-kernel, Albert Esteve
Move to using the new API devm_drm_panel_alloc() to allocate the
panel. In the call to the new API, avoid using explicit type and use
__typeof() for more type safety.
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Albert Esteve <aesteve@redhat.com>
---
drivers/gpu/drm/panel/panel-tdo-tl070wsh30.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-tdo-tl070wsh30.c b/drivers/gpu/drm/panel/panel-tdo-tl070wsh30.c
index 227f97f9b136f..13cfe252a838d 100644
--- a/drivers/gpu/drm/panel/panel-tdo-tl070wsh30.c
+++ b/drivers/gpu/drm/panel/panel-tdo-tl070wsh30.c
@@ -162,9 +162,6 @@ static int tdo_tl070wsh30_panel_add(struct tdo_tl070wsh30_panel *tdo_tl070wsh30)
return err;
}
- drm_panel_init(&tdo_tl070wsh30->base, &tdo_tl070wsh30->link->dev,
- &tdo_tl070wsh30_panel_funcs, DRM_MODE_CONNECTOR_DSI);
-
err = drm_panel_of_backlight(&tdo_tl070wsh30->base);
if (err)
return err;
@@ -183,10 +180,13 @@ static int tdo_tl070wsh30_panel_probe(struct mipi_dsi_device *dsi)
dsi->format = MIPI_DSI_FMT_RGB888;
dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | MIPI_DSI_MODE_LPM;
- tdo_tl070wsh30 = devm_kzalloc(&dsi->dev, sizeof(*tdo_tl070wsh30),
- GFP_KERNEL);
- if (!tdo_tl070wsh30)
- return -ENOMEM;
+ tdo_tl070wsh30 = devm_drm_panel_alloc(&dsi->dev,
+ __typeof(*tdo_tl070wsh30), base,
+ &tdo_tl070wsh30_panel_funcs,
+ DRM_MODE_CONNECTOR_DSI);
+
+ if (IS_ERR(tdo_tl070wsh30))
+ return PTR_ERR(tdo_tl070wsh30);
mipi_dsi_set_drvdata(dsi, tdo_tl070wsh30);
tdo_tl070wsh30->link = dsi;
--
2.53.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH v2 07/10] drm/panel/sharp-ls043t1le01: Use refcounted allocation in place of devm_kzalloc()
2026-05-08 7:04 [PATCH v2 00/10] drm/panel: Use refcounted allocation for remaining panel drivers Albert Esteve
` (5 preceding siblings ...)
2026-05-08 7:04 ` [PATCH v2 06/10] drm/panel/tdo-tl070wsh30: " Albert Esteve
@ 2026-05-08 7:04 ` Albert Esteve
2026-05-08 7:04 ` [PATCH v2 08/10] drm/panel/truly-nt35597: " Albert Esteve
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Albert Esteve @ 2026-05-08 7:04 UTC (permalink / raw)
To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Michael Tretter,
Michael Walle, Dario Binacchi
Cc: dri-devel, linux-kernel, Albert Esteve
Move to using the new API devm_drm_panel_alloc() to allocate the
panel. In the call to the new API, avoid using explicit type and use
__typeof() for more type safety.
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Albert Esteve <aesteve@redhat.com>
---
drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
index dd1eaba23ad3c..989b030ea22de 100644
--- a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
+++ b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
@@ -199,8 +199,6 @@ static int sharp_nt_panel_add(struct sharp_nt_panel *sharp_nt)
gpiod_set_value(sharp_nt->reset_gpio, 0);
}
- drm_panel_init(&sharp_nt->base, &sharp_nt->dsi->dev,
- &sharp_nt_panel_funcs, DRM_MODE_CONNECTOR_DSI);
sharp_nt->base.prepare_prev_first = true;
ret = drm_panel_of_backlight(&sharp_nt->base);
@@ -231,9 +229,12 @@ static int sharp_nt_panel_probe(struct mipi_dsi_device *dsi)
MIPI_DSI_CLOCK_NON_CONTINUOUS |
MIPI_DSI_MODE_NO_EOT_PACKET;
- sharp_nt = devm_kzalloc(&dsi->dev, sizeof(*sharp_nt), GFP_KERNEL);
- if (!sharp_nt)
- return -ENOMEM;
+ sharp_nt = devm_drm_panel_alloc(&dsi->dev, __typeof(*sharp_nt), base,
+ &sharp_nt_panel_funcs,
+ DRM_MODE_CONNECTOR_DSI);
+
+ if (IS_ERR(sharp_nt))
+ return PTR_ERR(sharp_nt);
mipi_dsi_set_drvdata(dsi, sharp_nt);
--
2.53.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH v2 08/10] drm/panel/truly-nt35597: Use refcounted allocation in place of devm_kzalloc()
2026-05-08 7:04 [PATCH v2 00/10] drm/panel: Use refcounted allocation for remaining panel drivers Albert Esteve
` (6 preceding siblings ...)
2026-05-08 7:04 ` [PATCH v2 07/10] drm/panel/sharp-ls043t1le01: " Albert Esteve
@ 2026-05-08 7:04 ` Albert Esteve
2026-05-08 7:04 ` [PATCH v2 09/10] drm/panel/startek-kd070fhfid015: " Albert Esteve
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Albert Esteve @ 2026-05-08 7:04 UTC (permalink / raw)
To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Michael Tretter,
Michael Walle, Dario Binacchi
Cc: dri-devel, linux-kernel, Albert Esteve
Move to using the new API devm_drm_panel_alloc() to allocate the
panel. In the call to the new API, avoid using explicit type and use
__typeof() for more type safety.
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Albert Esteve <aesteve@redhat.com>
---
drivers/gpu/drm/panel/panel-truly-nt35597.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-truly-nt35597.c b/drivers/gpu/drm/panel/panel-truly-nt35597.c
index d447db912a61e..f740b9257c09c 100644
--- a/drivers/gpu/drm/panel/panel-truly-nt35597.c
+++ b/drivers/gpu/drm/panel/panel-truly-nt35597.c
@@ -476,8 +476,6 @@ static int truly_nt35597_panel_add(struct truly_nt35597 *ctx)
/* dual port */
gpiod_set_value(ctx->mode_gpio, 0);
- drm_panel_init(&ctx->panel, dev, &truly_nt35597_drm_funcs,
- DRM_MODE_CONNECTOR_DSI);
drm_panel_add(&ctx->panel);
return 0;
@@ -523,10 +521,12 @@ static int truly_nt35597_probe(struct mipi_dsi_device *dsi)
.node = NULL,
};
- ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
+ ctx = devm_drm_panel_alloc(dev, __typeof(*ctx), panel,
+ &truly_nt35597_drm_funcs,
+ DRM_MODE_CONNECTOR_DSI);
- if (!ctx)
- return -ENOMEM;
+ if (IS_ERR(ctx))
+ return PTR_ERR(ctx);
/*
* This device represents itself as one with two input ports which are
--
2.53.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH v2 09/10] drm/panel/startek-kd070fhfid015: Use refcounted allocation in place of devm_kzalloc()
2026-05-08 7:04 [PATCH v2 00/10] drm/panel: Use refcounted allocation for remaining panel drivers Albert Esteve
` (7 preceding siblings ...)
2026-05-08 7:04 ` [PATCH v2 08/10] drm/panel/truly-nt35597: " Albert Esteve
@ 2026-05-08 7:04 ` Albert Esteve
2026-05-08 7:04 ` [PATCH v2 10/10] drm/panel: Make drm_panel_init() static Albert Esteve
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Albert Esteve @ 2026-05-08 7:04 UTC (permalink / raw)
To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Michael Tretter,
Michael Walle, Dario Binacchi
Cc: dri-devel, linux-kernel, Albert Esteve
Move to using the new API devm_drm_panel_alloc() to allocate the
panel. In the call to the new API, avoid using explicit type and use
__typeof() for more type safety.
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Albert Esteve <aesteve@redhat.com>
---
drivers/gpu/drm/panel/panel-startek-kd070fhfid015.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-startek-kd070fhfid015.c b/drivers/gpu/drm/panel/panel-startek-kd070fhfid015.c
index c0c95355b7435..7f04b7b404e7d 100644
--- a/drivers/gpu/drm/panel/panel-startek-kd070fhfid015.c
+++ b/drivers/gpu/drm/panel/panel-startek-kd070fhfid015.c
@@ -286,9 +286,6 @@ static int stk_panel_add(struct stk_panel *stk)
return ret;
}
- drm_panel_init(&stk->base, &stk->dsi->dev, &stk_panel_funcs,
- DRM_MODE_CONNECTOR_DSI);
-
drm_panel_add(&stk->base);
return 0;
@@ -303,9 +300,12 @@ static int stk_panel_probe(struct mipi_dsi_device *dsi)
dsi->format = MIPI_DSI_FMT_RGB888;
dsi->mode_flags = (MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_LPM);
- stk = devm_kzalloc(&dsi->dev, sizeof(*stk), GFP_KERNEL);
- if (!stk)
- return -ENOMEM;
+ stk = devm_drm_panel_alloc(&dsi->dev, __typeof(*stk), base,
+ &stk_panel_funcs,
+ DRM_MODE_CONNECTOR_DSI);
+
+ if (IS_ERR(stk))
+ return PTR_ERR(stk);
mipi_dsi_set_drvdata(dsi, stk);
--
2.53.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH v2 10/10] drm/panel: Make drm_panel_init() static
2026-05-08 7:04 [PATCH v2 00/10] drm/panel: Use refcounted allocation for remaining panel drivers Albert Esteve
` (8 preceding siblings ...)
2026-05-08 7:04 ` [PATCH v2 09/10] drm/panel/startek-kd070fhfid015: " Albert Esteve
@ 2026-05-08 7:04 ` Albert Esteve
2026-05-08 7:29 ` [PATCH v2 00/10] drm/panel: Use refcounted allocation for remaining panel drivers Thomas Zimmermann
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Albert Esteve @ 2026-05-08 7:04 UTC (permalink / raw)
To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Michael Tretter,
Michael Walle, Dario Binacchi
Cc: dri-devel, linux-kernel, Albert Esteve
Now that all panel drivers use devm_drm_panel_alloc(),
there are no external callers of drm_panel_init().
Make it static to prevent new users from bypassing the
refcounted allocation path.
Remove stale references to drm_panel_init() in kdocs.
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Albert Esteve <aesteve@redhat.com>
---
drivers/gpu/drm/display/drm_dp_helper.c | 2 --
drivers/gpu/drm/drm_panel.c | 7 +++----
include/drm/drm_panel.h | 4 ----
3 files changed, 3 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/display/drm_dp_helper.c b/drivers/gpu/drm/display/drm_dp_helper.c
index a697cc227e289..6d5556e3c134c 100644
--- a/drivers/gpu/drm/display/drm_dp_helper.c
+++ b/drivers/gpu/drm/display/drm_dp_helper.c
@@ -4626,8 +4626,6 @@ static const struct backlight_ops dp_aux_bl_ops = {
* Backlight will then be handled transparently without requiring
* any intervention from the driver.
*
- * drm_panel_dp_aux_backlight() must be called after the call to drm_panel_init().
- *
* Return: 0 on success or a negative error code on failure.
*/
int drm_panel_dp_aux_backlight(struct drm_panel *panel, struct drm_dp_aux *aux)
diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
index d1e6598ea3bc0..9c3cbc7aea2c3 100644
--- a/drivers/gpu/drm/drm_panel.c
+++ b/drivers/gpu/drm/drm_panel.c
@@ -56,8 +56,9 @@ static LIST_HEAD(panel_list);
* Initialize the panel structure for subsequent registration with
* drm_panel_add().
*/
-void drm_panel_init(struct drm_panel *panel, struct device *dev,
- const struct drm_panel_funcs *funcs, int connector_type)
+static void drm_panel_init(struct drm_panel *panel, struct device *dev,
+ const struct drm_panel_funcs *funcs,
+ int connector_type)
{
if (connector_type == DRM_MODE_CONNECTOR_Unknown)
DRM_WARN("%s: %s: a valid connector type is required!\n", __func__, dev_name(dev));
@@ -69,7 +70,6 @@ void drm_panel_init(struct drm_panel *panel, struct device *dev,
panel->funcs = funcs;
panel->connector_type = connector_type;
}
-EXPORT_SYMBOL(drm_panel_init);
/**
* drm_panel_add - add a panel to the global registry
@@ -708,7 +708,6 @@ EXPORT_SYMBOL(devm_drm_panel_add_follower);
* A typical implementation for a panel driver supporting device tree
* will call this function at probe time. Backlight will then be handled
* transparently without requiring any intervention from the driver.
- * drm_panel_of_backlight() must be called after the call to drm_panel_init().
*
* Return: 0 on success or a negative error code on failure.
*/
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index 2407bfa60236f..55cbc51512240 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -320,10 +320,6 @@ void *__devm_drm_panel_alloc(struct device *dev, size_t size, size_t offset,
offsetof(type, member), funcs, \
connector_type))
-void drm_panel_init(struct drm_panel *panel, struct device *dev,
- const struct drm_panel_funcs *funcs,
- int connector_type);
-
struct drm_panel *drm_panel_get(struct drm_panel *panel);
void drm_panel_put(struct drm_panel *panel);
--
2.53.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH v2 00/10] drm/panel: Use refcounted allocation for remaining panel drivers
2026-05-08 7:04 [PATCH v2 00/10] drm/panel: Use refcounted allocation for remaining panel drivers Albert Esteve
` (9 preceding siblings ...)
2026-05-08 7:04 ` [PATCH v2 10/10] drm/panel: Make drm_panel_init() static Albert Esteve
@ 2026-05-08 7:29 ` Thomas Zimmermann
2026-05-08 11:28 ` Dmitry Baryshkov
2026-05-11 7:16 ` Maxime Ripard
12 siblings, 0 replies; 14+ messages in thread
From: Thomas Zimmermann @ 2026-05-08 7:29 UTC (permalink / raw)
To: Albert Esteve, Neil Armstrong, Jessica Zhang, Maarten Lankhorst,
Maxime Ripard, David Airlie, Simona Vetter, Michael Tretter,
Michael Walle, Dario Binacchi
Cc: dri-devel, linux-kernel
For this series:
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Am 08.05.26 um 09:04 schrieb Albert Esteve:
> This series converts 9 remaining panel drivers from the deprecated
> devm_kzalloc() + drm_panel_init() pattern to the refcounted
> devm_drm_panel_alloc() API. This follows the work by Anusha Srivatsa
> who introduced the refcounted panel allocation infrastructure [1] and
> converted a first batch of drivers [2] (the last part of a 5 sub-series).
>
> Reasoning:
> ----------
> The old allocation pattern is unsafe: when the panel device is
> unbound, devm frees the context struct immediately, but the DRM
> device may still hold a reference to the embedded drm_panel through
> the panel bridge, leading to a use-after-free. devm_drm_panel_alloc()
> wraps the allocation in a kref scheme, so the memory is only freed
> when the last reference is dropped.
>
> After this series, there are no remaining callers of drm_panel_init()
> under drivers/gpu/drm/panel/, and drm_panel_init() is entirely removed
> from the public API.
>
> [1] https://lore.kernel.org/all/20250331-b4-panel-refcounting-v4-0-dad50c60c6c9@redhat.com/
> [2] https://lore.kernel.org/all/20250710-b4-driver-convert-last-part-july-v1-0-de73ba81b2f5@redhat.com/
>
> Signed-off-by: Albert Esteve <aesteve@redhat.com>
> ---
> Changes in v2:
> - Remove drm_panel_init/alloc precedence mentions in kdocs
> - Link to v1: https://lore.kernel.org/r/20260507-drm_panel_init_rm-v1-0-51f448c7c291@redhat.com
>
> ---
> Albert Esteve (10):
> drm/panel/visionox-g2647fb105: Use refcounted allocation in place of devm_kzalloc()
> drm/panel/samsung-s6e63m0: Use refcounted allocation in place of devm_kzalloc()
> drm/panel/novatek-nt37700f: Use refcounted allocation in place of devm_kzalloc()
> drm/panel/lxd-m9189a: Use refcounted allocation in place of devm_kzalloc()
> drm/panel/ilitek-ili9806e: Use refcounted allocation in place of devm_kzalloc()
> drm/panel/tdo-tl070wsh30: Use refcounted allocation in place of devm_kzalloc()
> drm/panel/sharp-ls043t1le01: Use refcounted allocation in place of devm_kzalloc()
> drm/panel/truly-nt35597: Use refcounted allocation in place of devm_kzalloc()
> drm/panel/startek-kd070fhfid015: Use refcounted allocation in place of devm_kzalloc()
> drm/panel: Make drm_panel_init() static
>
> drivers/gpu/drm/display/drm_dp_helper.c | 2 --
> drivers/gpu/drm/drm_panel.c | 7 +++----
> drivers/gpu/drm/panel/panel-ilitek-ili9806e-core.c | 10 +++++-----
> drivers/gpu/drm/panel/panel-lxd-m9189a.c | 11 ++++++-----
> drivers/gpu/drm/panel/panel-novatek-nt37700f.c | 11 ++++++-----
> drivers/gpu/drm/panel/panel-samsung-s6e63m0.c | 14 +++++++-------
> drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c | 11 ++++++-----
> drivers/gpu/drm/panel/panel-startek-kd070fhfid015.c | 12 ++++++------
> drivers/gpu/drm/panel/panel-tdo-tl070wsh30.c | 14 +++++++-------
> drivers/gpu/drm/panel/panel-truly-nt35597.c | 10 +++++-----
> drivers/gpu/drm/panel/panel-visionox-g2647fb105.c | 13 ++++++-------
> include/drm/drm_panel.h | 4 ----
> 12 files changed, 57 insertions(+), 62 deletions(-)
> ---
> base-commit: 74fe02ce122a6103f207d29fafc8b3a53de6abaf
> change-id: 20260506-drm_panel_init_rm-3a4489701f10
>
> Best regards,
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH v2 00/10] drm/panel: Use refcounted allocation for remaining panel drivers
2026-05-08 7:04 [PATCH v2 00/10] drm/panel: Use refcounted allocation for remaining panel drivers Albert Esteve
` (10 preceding siblings ...)
2026-05-08 7:29 ` [PATCH v2 00/10] drm/panel: Use refcounted allocation for remaining panel drivers Thomas Zimmermann
@ 2026-05-08 11:28 ` Dmitry Baryshkov
2026-05-11 7:16 ` Maxime Ripard
12 siblings, 0 replies; 14+ messages in thread
From: Dmitry Baryshkov @ 2026-05-08 11:28 UTC (permalink / raw)
To: Albert Esteve
Cc: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Michael Tretter,
Michael Walle, Dario Binacchi, dri-devel, linux-kernel
On Fri, May 08, 2026 at 09:04:40AM +0200, Albert Esteve wrote:
> This series converts 9 remaining panel drivers from the deprecated
> devm_kzalloc() + drm_panel_init() pattern to the refcounted
> devm_drm_panel_alloc() API. This follows the work by Anusha Srivatsa
> who introduced the refcounted panel allocation infrastructure [1] and
> converted a first batch of drivers [2] (the last part of a 5 sub-series).
>
> Reasoning:
> ----------
> The old allocation pattern is unsafe: when the panel device is
> unbound, devm frees the context struct immediately, but the DRM
> device may still hold a reference to the embedded drm_panel through
> the panel bridge, leading to a use-after-free. devm_drm_panel_alloc()
> wraps the allocation in a kref scheme, so the memory is only freed
> when the last reference is dropped.
>
> After this series, there are no remaining callers of drm_panel_init()
> under drivers/gpu/drm/panel/, and drm_panel_init() is entirely removed
> from the public API.
>
> [1] https://lore.kernel.org/all/20250331-b4-panel-refcounting-v4-0-dad50c60c6c9@redhat.com/
> [2] https://lore.kernel.org/all/20250710-b4-driver-convert-last-part-july-v1-0-de73ba81b2f5@redhat.com/
>
> Signed-off-by: Albert Esteve <aesteve@redhat.com>
> ---
> Changes in v2:
> - Remove drm_panel_init/alloc precedence mentions in kdocs
> - Link to v1: https://lore.kernel.org/r/20260507-drm_panel_init_rm-v1-0-51f448c7c291@redhat.com
>
For the series:
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH v2 00/10] drm/panel: Use refcounted allocation for remaining panel drivers
2026-05-08 7:04 [PATCH v2 00/10] drm/panel: Use refcounted allocation for remaining panel drivers Albert Esteve
` (11 preceding siblings ...)
2026-05-08 11:28 ` Dmitry Baryshkov
@ 2026-05-11 7:16 ` Maxime Ripard
12 siblings, 0 replies; 14+ messages in thread
From: Maxime Ripard @ 2026-05-11 7:16 UTC (permalink / raw)
To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst,
Thomas Zimmermann, David Airlie, Simona Vetter, Michael Tretter,
Michael Walle, Dario Binacchi, Albert Esteve
Cc: Maxime Ripard, dri-devel, linux-kernel
On Fri, 08 May 2026 09:04:40 +0200, Albert Esteve wrote:
> This series converts 9 remaining panel drivers from the deprecated
> devm_kzalloc() + drm_panel_init() pattern to the refcounted
> devm_drm_panel_alloc() API. This follows the work by Anusha Srivatsa
> who introduced the refcounted panel allocation infrastructure [1] and
> converted a first batch of drivers [2] (the last part of a 5 sub-series).
>
> Reasoning:
> ----------
> The old allocation pattern is unsafe: when the panel device is
> unbound, devm frees the context struct immediately, but the DRM
> device may still hold a reference to the embedded drm_panel through
> the panel bridge, leading to a use-after-free. devm_drm_panel_alloc()
> wraps the allocation in a kref scheme, so the memory is only freed
> when the last reference is dropped.
>
> [...]
Applied to misc/kernel.git (drm-misc-next).
Thanks!
Maxime
^ permalink raw reply [flat|nested] 14+ messages in thread