* [PATCH v2 02/34] platform: arm64: acer-aspire1-ec: convert to devm_drm_bridge_alloc() API
[not found] <20250424-drm-bridge-convert-to-alloc-api-v2-0-8f91a404d86b@bootlin.com>
@ 2025-04-24 18:59 ` Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 03/34] drm/bridge: analogix-anx6345: " Luca Ceresoli
` (31 subsequent siblings)
32 siblings, 0 replies; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-24 18:59 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Luca Ceresoli,
Ilpo Järvinen, Bryan O'Donoghue, Hans de Goede
This is the new API for allocating DRM bridges.
Acked-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Cc: "Bryan O'Donoghue" <bryan.odonoghue@linaro.org>
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: Hans de Goede <hdegoede@redhat.com>
---
drivers/platform/arm64/acer-aspire1-ec.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/platform/arm64/acer-aspire1-ec.c b/drivers/platform/arm64/acer-aspire1-ec.c
index 958fe1bf5f85bb69ac7962f217de9f0b40cde9a1..438532a047e68799ac53a16a4c813fc16be997b9 100644
--- a/drivers/platform/arm64/acer-aspire1-ec.c
+++ b/drivers/platform/arm64/acer-aspire1-ec.c
@@ -452,9 +452,9 @@ static int aspire_ec_probe(struct i2c_client *client)
int ret;
u8 tmp;
- ec = devm_kzalloc(dev, sizeof(*ec), GFP_KERNEL);
- if (!ec)
- return -ENOMEM;
+ ec = devm_drm_bridge_alloc(dev, struct aspire_ec, bridge, &aspire_ec_bridge_funcs);
+ if (IS_ERR(ec))
+ return PTR_ERR(ec);
ec->client = client;
i2c_set_clientdata(client, ec);
@@ -497,7 +497,6 @@ static int aspire_ec_probe(struct i2c_client *client)
fwnode = device_get_named_child_node(dev, "connector");
if (fwnode) {
INIT_WORK(&ec->work, aspire_ec_bridge_update_hpd_work);
- ec->bridge.funcs = &aspire_ec_bridge_funcs;
ec->bridge.of_node = to_of_node(fwnode);
ec->bridge.ops = DRM_BRIDGE_OP_HPD;
ec->bridge.type = DRM_MODE_CONNECTOR_USB;
--
2.49.0
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH v2 03/34] drm/bridge: analogix-anx6345: convert to devm_drm_bridge_alloc() API
[not found] <20250424-drm-bridge-convert-to-alloc-api-v2-0-8f91a404d86b@bootlin.com>
2025-04-24 18:59 ` [PATCH v2 02/34] platform: arm64: acer-aspire1-ec: convert to devm_drm_bridge_alloc() API Luca Ceresoli
@ 2025-04-24 18:59 ` Luca Ceresoli
2025-04-28 12:29 ` Andy Yan
2025-04-24 18:59 ` [PATCH v2 04/34] drm/bridge: anx7625: " Luca Ceresoli
` (30 subsequent siblings)
32 siblings, 1 reply; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-24 18:59 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Luca Ceresoli,
Uwe Kleine-König, Andy Yan, Dmitry Baryshkov, Jani Nikula,
Sui Jingfeng
This is the new API for allocating DRM bridges.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Cc: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Cc: Andy Yan <andy.yan@rock-chips.com>
Cc: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Sui Jingfeng <sui.jingfeng@linux.dev>
---
drivers/gpu/drm/bridge/analogix/analogix-anx6345.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
index f2bafa6cf77956ecafc87aae3a2b6890bdb36cfa..f3fe47b12edca1f92ddd306d152be144df5649b5 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
@@ -664,9 +664,10 @@ static int anx6345_i2c_probe(struct i2c_client *client)
struct device *dev;
int i, err;
- anx6345 = devm_kzalloc(&client->dev, sizeof(*anx6345), GFP_KERNEL);
- if (!anx6345)
- return -ENOMEM;
+ anx6345 = devm_drm_bridge_alloc(&client->dev, struct anx6345, bridge,
+ &anx6345_bridge_funcs);
+ if (IS_ERR(anx6345))
+ return PTR_ERR(anx6345);
mutex_init(&anx6345->lock);
@@ -738,7 +739,6 @@ static int anx6345_i2c_probe(struct i2c_client *client)
/* Look for supported chip ID */
anx6345_poweron(anx6345);
if (anx6345_get_chip_id(anx6345)) {
- anx6345->bridge.funcs = &anx6345_bridge_funcs;
drm_bridge_add(&anx6345->bridge);
return 0;
--
2.49.0
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH v2 04/34] drm/bridge: anx7625: convert to devm_drm_bridge_alloc() API
[not found] <20250424-drm-bridge-convert-to-alloc-api-v2-0-8f91a404d86b@bootlin.com>
2025-04-24 18:59 ` [PATCH v2 02/34] platform: arm64: acer-aspire1-ec: convert to devm_drm_bridge_alloc() API Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 03/34] drm/bridge: analogix-anx6345: " Luca Ceresoli
@ 2025-04-24 18:59 ` Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 05/34] drm/bridge: cdns-dsi: " Luca Ceresoli
` (29 subsequent siblings)
32 siblings, 0 replies; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-24 18:59 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Luca Ceresoli,
Rob Herring (Arm), Hsin-Te Yuan, Jani Nikula, Pin-yen Lin,
Sui Jingfeng, Xin Ji
This is the new API for allocating DRM bridges.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Cc: "Rob Herring (Arm)" <robh@kernel.org>
Cc: Hsin-Te Yuan <yuanhsinte@chromium.org>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Pin-yen Lin <treapking@chromium.org>
Cc: Sui Jingfeng <sui.jingfeng@linux.dev>
Cc: Xin Ji <xji@analogixsemi.com>
---
drivers/gpu/drm/bridge/analogix/anx7625.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
index 8bfe477c476c045f8a08b6d646da7bae77693fdf..bdf8f7762e0c19d19e4c60ca0841edfc3625592c 100644
--- a/drivers/gpu/drm/bridge/analogix/anx7625.c
+++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
@@ -2581,7 +2581,6 @@ static int anx7625_link_bridge(struct drm_dp_aux *aux)
return ret;
}
- platform->bridge.funcs = &anx7625_bridge_funcs;
platform->bridge.of_node = dev->of_node;
if (!anx7625_of_panel_on_aux_bus(dev))
platform->bridge.ops |= DRM_BRIDGE_OP_EDID;
@@ -2616,10 +2615,10 @@ static int anx7625_i2c_probe(struct i2c_client *client)
return -ENODEV;
}
- platform = devm_kzalloc(dev, sizeof(*platform), GFP_KERNEL);
- if (!platform) {
+ platform = devm_drm_bridge_alloc(dev, struct anx7625_data, bridge, &anx7625_bridge_funcs);
+ if (IS_ERR(platform)) {
DRM_DEV_ERROR(dev, "fail to allocate driver data\n");
- return -ENOMEM;
+ return PTR_ERR(platform);
}
pdata = &platform->pdata;
--
2.49.0
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH v2 05/34] drm/bridge: cdns-dsi: convert to devm_drm_bridge_alloc() API
[not found] <20250424-drm-bridge-convert-to-alloc-api-v2-0-8f91a404d86b@bootlin.com>
` (2 preceding siblings ...)
2025-04-24 18:59 ` [PATCH v2 04/34] drm/bridge: anx7625: " Luca Ceresoli
@ 2025-04-24 18:59 ` Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 06/34] drm/bridge: display-connector: " Luca Ceresoli
` (28 subsequent siblings)
32 siblings, 0 replies; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-24 18:59 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Luca Ceresoli,
Aradhya Bhatia, Tomi Valkeinen
This is the new API for allocating DRM bridges.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Cc: Aradhya Bhatia <a-bhatia1@ti.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
index b022dd6e6b6e9e43bf11583806e1a8d1e7431ae8..7604574da66606c103cc035dd94b0e211b64ebdc 100644
--- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
+++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
@@ -1289,9 +1289,10 @@ static int cdns_dsi_drm_probe(struct platform_device *pdev)
int ret, irq;
u32 val;
- dsi = devm_kzalloc(&pdev->dev, sizeof(*dsi), GFP_KERNEL);
- if (!dsi)
- return -ENOMEM;
+ dsi = devm_drm_bridge_alloc(&pdev->dev, struct cdns_dsi, input.bridge,
+ &cdns_dsi_bridge_funcs);
+ if (IS_ERR(dsi))
+ return PTR_ERR(dsi);
platform_set_drvdata(pdev, dsi);
@@ -1349,7 +1350,6 @@ static int cdns_dsi_drm_probe(struct platform_device *pdev)
* CDNS_DPI_INPUT.
*/
input->id = CDNS_DPI_INPUT;
- input->bridge.funcs = &cdns_dsi_bridge_funcs;
input->bridge.of_node = pdev->dev.of_node;
/* Mask all interrupts before registering the IRQ handler. */
--
2.49.0
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH v2 06/34] drm/bridge: display-connector: convert to devm_drm_bridge_alloc() API
[not found] <20250424-drm-bridge-convert-to-alloc-api-v2-0-8f91a404d86b@bootlin.com>
` (3 preceding siblings ...)
2025-04-24 18:59 ` [PATCH v2 05/34] drm/bridge: cdns-dsi: " Luca Ceresoli
@ 2025-04-24 18:59 ` Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 07/34] drm/bridge: lt9611uxc: " Luca Ceresoli
` (27 subsequent siblings)
32 siblings, 0 replies; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-24 18:59 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Luca Ceresoli,
Dmitry Baryshkov
This is the new API for allocating DRM bridges.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/bridge/display-connector.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/bridge/display-connector.c b/drivers/gpu/drm/bridge/display-connector.c
index 09c08a53d5bdc5c48f5d520472f5a311289d4862..badd2c7f91a186e9a47c5a4ddc870d269f3798ab 100644
--- a/drivers/gpu/drm/bridge/display-connector.c
+++ b/drivers/gpu/drm/bridge/display-connector.c
@@ -210,9 +210,10 @@ static int display_connector_probe(struct platform_device *pdev)
const char *label = NULL;
int ret;
- conn = devm_kzalloc(&pdev->dev, sizeof(*conn), GFP_KERNEL);
- if (!conn)
- return -ENOMEM;
+ conn = devm_drm_bridge_alloc(&pdev->dev, struct display_connector, bridge,
+ &display_connector_bridge_funcs);
+ if (IS_ERR(conn))
+ return PTR_ERR(conn);
platform_set_drvdata(pdev, conn);
@@ -362,7 +363,6 @@ static int display_connector_probe(struct platform_device *pdev)
}
}
- conn->bridge.funcs = &display_connector_bridge_funcs;
conn->bridge.of_node = pdev->dev.of_node;
if (conn->bridge.ddc)
--
2.49.0
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH v2 07/34] drm/bridge: lt9611uxc: convert to devm_drm_bridge_alloc() API
[not found] <20250424-drm-bridge-convert-to-alloc-api-v2-0-8f91a404d86b@bootlin.com>
` (4 preceding siblings ...)
2025-04-24 18:59 ` [PATCH v2 06/34] drm/bridge: display-connector: " Luca Ceresoli
@ 2025-04-24 18:59 ` Luca Ceresoli
2025-04-29 12:09 ` Dmitry Baryshkov
2025-04-24 18:59 ` [PATCH v2 08/34] drm/bridge: megachips-stdpxxxx-ge-b850v3-fw: " Luca Ceresoli
` (26 subsequent siblings)
32 siblings, 1 reply; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-24 18:59 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Luca Ceresoli,
Dmitry Baryshkov
This is the new API for allocating DRM bridges.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/bridge/lontium-lt9611uxc.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c
index bb33c30d3f88878736815b270813a035222aead1..766da2cb45a7e2a79256185b8e2d3bd1eff3648f 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c
@@ -775,9 +775,9 @@ static int lt9611uxc_probe(struct i2c_client *client)
return -ENODEV;
}
- lt9611uxc = devm_kzalloc(dev, sizeof(*lt9611uxc), GFP_KERNEL);
- if (!lt9611uxc)
- return -ENOMEM;
+ lt9611uxc = devm_drm_bridge_alloc(dev, struct lt9611uxc, bridge, <9611uxc_bridge_funcs);
+ if (IS_ERR(lt9611uxc))
+ return PTR_ERR(lt9611uxc);
lt9611uxc->dev = dev;
lt9611uxc->client = client;
@@ -856,7 +856,6 @@ static int lt9611uxc_probe(struct i2c_client *client)
i2c_set_clientdata(client, lt9611uxc);
- lt9611uxc->bridge.funcs = <9611uxc_bridge_funcs;
lt9611uxc->bridge.of_node = client->dev.of_node;
lt9611uxc->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID;
if (lt9611uxc->hpd_supported)
--
2.49.0
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH v2 08/34] drm/bridge: megachips-stdpxxxx-ge-b850v3-fw: convert to devm_drm_bridge_alloc() API
[not found] <20250424-drm-bridge-convert-to-alloc-api-v2-0-8f91a404d86b@bootlin.com>
` (5 preceding siblings ...)
2025-04-24 18:59 ` [PATCH v2 07/34] drm/bridge: lt9611uxc: " Luca Ceresoli
@ 2025-04-24 18:59 ` Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 09/34] drm/bridge: nxp-ptn3460: " Luca Ceresoli
` (25 subsequent siblings)
32 siblings, 0 replies; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-24 18:59 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Luca Ceresoli, Ian Ray,
Martyn Welch, Peter Senna Tschudin
This is the new API for allocating DRM bridges.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Cc: Ian Ray <ian.ray@ge.com>
Cc: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Peter Senna Tschudin <peter.senna@gmail.com>
---
drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c
index 15a5a1f644fc10182c55bc9e489ccb81d4f924f9..81dde9ed7bcf7cacae000d9da31a3a5c347ce037 100644
--- a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c
+++ b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c
@@ -225,13 +225,11 @@ static int ge_b850v3_lvds_init(struct device *dev)
if (ge_b850v3_lvds_ptr)
goto success;
- ge_b850v3_lvds_ptr = devm_kzalloc(dev,
- sizeof(*ge_b850v3_lvds_ptr),
- GFP_KERNEL);
-
- if (!ge_b850v3_lvds_ptr) {
+ ge_b850v3_lvds_ptr = devm_drm_bridge_alloc(dev, struct ge_b850v3_lvds, bridge,
+ &ge_b850v3_lvds_funcs);
+ if (IS_ERR(ge_b850v3_lvds_ptr)) {
mutex_unlock(&ge_b850v3_lvds_dev_mutex);
- return -ENOMEM;
+ return PTR_ERR(ge_b850v3_lvds_ptr);
}
success:
@@ -264,7 +262,6 @@ static int ge_b850v3_register(void)
struct device *dev = &stdp4028_i2c->dev;
/* drm bridge initialization */
- ge_b850v3_lvds_ptr->bridge.funcs = &ge_b850v3_lvds_funcs;
ge_b850v3_lvds_ptr->bridge.ops = DRM_BRIDGE_OP_DETECT |
DRM_BRIDGE_OP_EDID;
ge_b850v3_lvds_ptr->bridge.type = DRM_MODE_CONNECTOR_DisplayPort;
--
2.49.0
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH v2 09/34] drm/bridge: nxp-ptn3460: convert to devm_drm_bridge_alloc() API
[not found] <20250424-drm-bridge-convert-to-alloc-api-v2-0-8f91a404d86b@bootlin.com>
` (6 preceding siblings ...)
2025-04-24 18:59 ` [PATCH v2 08/34] drm/bridge: megachips-stdpxxxx-ge-b850v3-fw: " Luca Ceresoli
@ 2025-04-24 18:59 ` Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 10/34] drm/bridge: sii902x: " Luca Ceresoli
` (24 subsequent siblings)
32 siblings, 0 replies; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-24 18:59 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Luca Ceresoli
This is the new API for allocating DRM bridges.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/bridge/nxp-ptn3460.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/bridge/nxp-ptn3460.c b/drivers/gpu/drm/bridge/nxp-ptn3460.c
index 25d7c415478b14ef634bff4185a8dd8e866be0c6..7acb11f16dc19e87a84cc765b1cebef158662c00 100644
--- a/drivers/gpu/drm/bridge/nxp-ptn3460.c
+++ b/drivers/gpu/drm/bridge/nxp-ptn3460.c
@@ -261,10 +261,10 @@ static int ptn3460_probe(struct i2c_client *client)
struct drm_bridge *panel_bridge;
int ret;
- ptn_bridge = devm_kzalloc(dev, sizeof(*ptn_bridge), GFP_KERNEL);
- if (!ptn_bridge) {
- return -ENOMEM;
- }
+ ptn_bridge = devm_drm_bridge_alloc(dev, struct ptn3460_bridge, bridge,
+ &ptn3460_bridge_funcs);
+ if (IS_ERR(ptn_bridge))
+ return PTR_ERR(ptn_bridge);
panel_bridge = devm_drm_of_get_bridge(dev, dev->of_node, 0, 0);
if (IS_ERR(panel_bridge))
@@ -300,7 +300,6 @@ static int ptn3460_probe(struct i2c_client *client)
return ret;
}
- ptn_bridge->bridge.funcs = &ptn3460_bridge_funcs;
ptn_bridge->bridge.ops = DRM_BRIDGE_OP_EDID;
ptn_bridge->bridge.type = DRM_MODE_CONNECTOR_LVDS;
ptn_bridge->bridge.of_node = dev->of_node;
--
2.49.0
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH v2 10/34] drm/bridge: sii902x: convert to devm_drm_bridge_alloc() API
[not found] <20250424-drm-bridge-convert-to-alloc-api-v2-0-8f91a404d86b@bootlin.com>
` (7 preceding siblings ...)
2025-04-24 18:59 ` [PATCH v2 09/34] drm/bridge: nxp-ptn3460: " Luca Ceresoli
@ 2025-04-24 18:59 ` Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 11/34] drm/bridge: dw-hdmi: " Luca Ceresoli
` (23 subsequent siblings)
32 siblings, 0 replies; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-24 18:59 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Luca Ceresoli
This is the new API for allocating DRM bridges.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/bridge/sii902x.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c
index 6de61d9fe06487856e8b3c32db3c8d8c25633fd8..882973e900628c0d972d32cd4ff3588432daa8e9 100644
--- a/drivers/gpu/drm/bridge/sii902x.c
+++ b/drivers/gpu/drm/bridge/sii902x.c
@@ -1135,7 +1135,6 @@ static int sii902x_init(struct sii902x *sii902x)
if (ret)
goto err_unreg_audio;
- sii902x->bridge.funcs = &sii902x_bridge_funcs;
sii902x->bridge.of_node = dev->of_node;
sii902x->bridge.timings = &default_sii902x_timings;
sii902x->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID;
@@ -1170,9 +1169,9 @@ static int sii902x_probe(struct i2c_client *client)
return -EIO;
}
- sii902x = devm_kzalloc(dev, sizeof(*sii902x), GFP_KERNEL);
- if (!sii902x)
- return -ENOMEM;
+ sii902x = devm_drm_bridge_alloc(dev, struct sii902x, bridge, &sii902x_bridge_funcs);
+ if (IS_ERR(sii902x))
+ return PTR_ERR(sii902x);
sii902x->i2c = client;
sii902x->regmap = devm_regmap_init_i2c(client, &sii902x_regmap_config);
--
2.49.0
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH v2 11/34] drm/bridge: dw-hdmi: convert to devm_drm_bridge_alloc() API
[not found] <20250424-drm-bridge-convert-to-alloc-api-v2-0-8f91a404d86b@bootlin.com>
` (8 preceding siblings ...)
2025-04-24 18:59 ` [PATCH v2 10/34] drm/bridge: sii902x: " Luca Ceresoli
@ 2025-04-24 18:59 ` Luca Ceresoli
2025-04-24 19:16 ` Cristian Ciocaltea
2025-04-24 18:59 ` [PATCH v2 12/34] drm/bridge: tda998x: " Luca Ceresoli
` (22 subsequent siblings)
32 siblings, 1 reply; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-24 18:59 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Luca Ceresoli,
Cristian Ciocaltea
This is the new API for allocating DRM bridges.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Cc: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index deaba3b6f99789067d14b76d228b58816a09b395..8791408dd1ff2d3c3b223b4f7f6f00edb275abf0 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -3333,9 +3333,9 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev,
u8 config0;
u8 config3;
- hdmi = devm_kzalloc(dev, sizeof(*hdmi), GFP_KERNEL);
- if (!hdmi)
- return ERR_PTR(-ENOMEM);
+ hdmi = devm_drm_bridge_alloc(dev, struct dw_hdmi, bridge, &dw_hdmi_bridge_funcs);
+ if (IS_ERR(hdmi))
+ return hdmi;
hdmi->plat_data = plat_data;
hdmi->dev = dev;
@@ -3495,7 +3495,6 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev,
}
hdmi->bridge.driver_private = hdmi;
- hdmi->bridge.funcs = &dw_hdmi_bridge_funcs;
hdmi->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID
| DRM_BRIDGE_OP_HPD;
hdmi->bridge.interlace_allowed = true;
--
2.49.0
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH v2 12/34] drm/bridge: tda998x: convert to devm_drm_bridge_alloc() API
[not found] <20250424-drm-bridge-convert-to-alloc-api-v2-0-8f91a404d86b@bootlin.com>
` (9 preceding siblings ...)
2025-04-24 18:59 ` [PATCH v2 11/34] drm/bridge: dw-hdmi: " Luca Ceresoli
@ 2025-04-24 18:59 ` Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 13/34] drm/bridge: ti-sn65dsi86: " Luca Ceresoli
` (21 subsequent siblings)
32 siblings, 0 replies; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-24 18:59 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Luca Ceresoli,
Dmitry Baryshkov, Russell King
This is the new API for allocating DRM bridges.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Cc: Russell King <linux@armlinux.org.uk>
---
drivers/gpu/drm/bridge/tda998x_drv.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/bridge/tda998x_drv.c b/drivers/gpu/drm/bridge/tda998x_drv.c
index ac87033ba5372e32cb8dc3abafc8cf1ff8273103..850909f78a7bc0fab54a60880f9a0657e99056f3 100644
--- a/drivers/gpu/drm/bridge/tda998x_drv.c
+++ b/drivers/gpu/drm/bridge/tda998x_drv.c
@@ -1781,9 +1781,9 @@ static int tda998x_create(struct device *dev)
u32 video;
int rev_lo, rev_hi, ret;
- priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
- if (!priv)
- return -ENOMEM;
+ priv = devm_drm_bridge_alloc(dev, struct tda998x_priv, bridge, &tda998x_bridge_funcs);
+ if (IS_ERR(priv))
+ return PTR_ERR(priv);
dev_set_drvdata(dev, priv);
@@ -1948,7 +1948,6 @@ static int tda998x_create(struct device *dev)
tda998x_audio_codec_init(priv, &client->dev);
}
- priv->bridge.funcs = &tda998x_bridge_funcs;
#ifdef CONFIG_OF
priv->bridge.of_node = dev->of_node;
#endif
--
2.49.0
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH v2 13/34] drm/bridge: ti-sn65dsi86: convert to devm_drm_bridge_alloc() API
[not found] <20250424-drm-bridge-convert-to-alloc-api-v2-0-8f91a404d86b@bootlin.com>
` (10 preceding siblings ...)
2025-04-24 18:59 ` [PATCH v2 12/34] drm/bridge: tda998x: " Luca Ceresoli
@ 2025-04-24 18:59 ` Luca Ceresoli
2025-04-28 20:53 ` Doug Anderson
2025-04-24 18:59 ` [PATCH v2 14/34] drm/exynos: mic: " Luca Ceresoli
` (20 subsequent siblings)
32 siblings, 1 reply; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-24 18:59 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Luca Ceresoli,
Herve Codina
This is the new API for allocating DRM bridges.
Reviewed-by: Herve Codina <herve.codina@bootlin.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/bridge/ti-sn65dsi86.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
index f72675766e01108d72033b8b83c25d3e4d8fd1a7..60224f476e1d048c693ab36a0a79b6897c6101a8 100644
--- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c
+++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
@@ -1317,7 +1317,6 @@ static int ti_sn_bridge_probe(struct auxiliary_device *adev,
if (ret)
return ret;
- pdata->bridge.funcs = &ti_sn_bridge_funcs;
pdata->bridge.of_node = np;
pdata->bridge.type = pdata->next_bridge->type == DRM_MODE_CONNECTOR_DisplayPort
? DRM_MODE_CONNECTOR_DisplayPort : DRM_MODE_CONNECTOR_eDP;
@@ -1907,9 +1906,9 @@ static int ti_sn65dsi86_probe(struct i2c_client *client)
return -ENODEV;
}
- pdata = devm_kzalloc(dev, sizeof(struct ti_sn65dsi86), GFP_KERNEL);
- if (!pdata)
- return -ENOMEM;
+ pdata = devm_drm_bridge_alloc(dev, struct ti_sn65dsi86, bridge, &ti_sn_bridge_funcs);
+ if (IS_ERR(pdata))
+ return PTR_ERR(pdata);
dev_set_drvdata(dev, pdata);
pdata->dev = dev;
--
2.49.0
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH v2 14/34] drm/exynos: mic: convert to devm_drm_bridge_alloc() API
[not found] <20250424-drm-bridge-convert-to-alloc-api-v2-0-8f91a404d86b@bootlin.com>
` (11 preceding siblings ...)
2025-04-24 18:59 ` [PATCH v2 13/34] drm/bridge: ti-sn65dsi86: " Luca Ceresoli
@ 2025-04-24 18:59 ` Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 15/34] drm/mcde: " Luca Ceresoli
` (19 subsequent siblings)
32 siblings, 0 replies; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-24 18:59 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Luca Ceresoli, Alim Akhtar,
Inki Dae, Kyungmin Park, Seung-Woo Kim
This is the new API for allocating DRM bridges.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Cc: Alim Akhtar <alim.akhtar@samsung.com>
Cc: Inki Dae <inki.dae@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Seung-Woo Kim <sw0312.kim@samsung.com>
---
drivers/gpu/drm/exynos/exynos_drm_mic.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_mic.c b/drivers/gpu/drm/exynos/exynos_drm_mic.c
index b34ec67283370e3fa836c7df06e12e2fba524622..29a8366513fa70655c6ceec9a09db0158e7bb169 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_mic.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_mic.c
@@ -379,11 +379,11 @@ static int exynos_mic_probe(struct platform_device *pdev)
struct resource res;
int ret, i;
- mic = devm_kzalloc(dev, sizeof(*mic), GFP_KERNEL);
- if (!mic) {
+ mic = devm_drm_bridge_alloc(dev, struct exynos_mic, bridge, &mic_bridge_funcs);
+ if (IS_ERR(mic)) {
DRM_DEV_ERROR(dev,
"mic: Failed to allocate memory for MIC object\n");
- ret = -ENOMEM;
+ ret = PTR_ERR(mic);
goto err;
}
@@ -421,7 +421,6 @@ static int exynos_mic_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, mic);
- mic->bridge.funcs = &mic_bridge_funcs;
mic->bridge.of_node = dev->of_node;
drm_bridge_add(&mic->bridge);
--
2.49.0
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH v2 15/34] drm/mcde: convert to devm_drm_bridge_alloc() API
[not found] <20250424-drm-bridge-convert-to-alloc-api-v2-0-8f91a404d86b@bootlin.com>
` (12 preceding siblings ...)
2025-04-24 18:59 ` [PATCH v2 14/34] drm/exynos: mic: " Luca Ceresoli
@ 2025-04-24 18:59 ` Luca Ceresoli
2025-04-29 8:40 ` Linus Walleij
2025-04-24 18:59 ` [PATCH v2 16/34] drm/msm/dp: " Luca Ceresoli
` (18 subsequent siblings)
32 siblings, 1 reply; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-24 18:59 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Luca Ceresoli,
Linus Walleij
This is the new API for allocating DRM bridges.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Cc: Linus Walleij <linus.walleij@linaro.org>
---
drivers/gpu/drm/mcde/mcde_dsi.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/mcde/mcde_dsi.c b/drivers/gpu/drm/mcde/mcde_dsi.c
index b302d8ec3ad0e82ace9c10194ae37948ebb8e753..a3423459dd7ac8395b77d0479a02ebb3a9ba259c 100644
--- a/drivers/gpu/drm/mcde/mcde_dsi.c
+++ b/drivers/gpu/drm/mcde/mcde_dsi.c
@@ -1138,7 +1138,6 @@ static int mcde_dsi_bind(struct device *dev, struct device *master,
d->bridge_out = bridge;
/* Create a bridge for this DSI channel */
- d->bridge.funcs = &mcde_dsi_bridge_funcs;
d->bridge.of_node = dev->of_node;
drm_bridge_add(&d->bridge);
@@ -1174,9 +1173,9 @@ static int mcde_dsi_probe(struct platform_device *pdev)
u32 dsi_id;
int ret;
- d = devm_kzalloc(dev, sizeof(*d), GFP_KERNEL);
- if (!d)
- return -ENOMEM;
+ d = devm_drm_bridge_alloc(dev, struct mcde_dsi, bridge, &mcde_dsi_bridge_funcs);
+ if (IS_ERR(d))
+ return PTR_ERR(d);
d->dev = dev;
platform_set_drvdata(pdev, d);
--
2.49.0
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH v2 16/34] drm/msm/dp: convert to devm_drm_bridge_alloc() API
[not found] <20250424-drm-bridge-convert-to-alloc-api-v2-0-8f91a404d86b@bootlin.com>
` (13 preceding siblings ...)
2025-04-24 18:59 ` [PATCH v2 15/34] drm/mcde: " Luca Ceresoli
@ 2025-04-24 18:59 ` Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 17/34] drm/msm/dsi: " Luca Ceresoli
` (17 subsequent siblings)
32 siblings, 0 replies; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-24 18:59 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Luca Ceresoli,
Dmitry Baryshkov, Abhinav Kumar, Bjorn Andersson, Marijn Suijten,
Rob Clark, Sean Paul
This is the new API for allocating DRM bridges.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Cc: Abhinav Kumar <quic_abhinavk@quicinc.com>
Cc: Bjorn Andersson <quic_bjorande@quicinc.com>
Cc: Marijn Suijten <marijn.suijten@somainline.org>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Sean Paul <sean@poorly.run>
---
drivers/gpu/drm/msm/dp/dp_drm.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/msm/dp/dp_drm.c b/drivers/gpu/drm/msm/dp/dp_drm.c
index cca57e56c906255a315e759e85a5af5982c80e9c..293f4745f1e20ba67da1d3fc218da3d90e1be588 100644
--- a/drivers/gpu/drm/msm/dp/dp_drm.c
+++ b/drivers/gpu/drm/msm/dp/dp_drm.c
@@ -296,14 +296,15 @@ int msm_dp_bridge_init(struct msm_dp *msm_dp_display, struct drm_device *dev,
struct msm_dp_bridge *msm_dp_bridge;
struct drm_bridge *bridge;
- msm_dp_bridge = devm_kzalloc(dev->dev, sizeof(*msm_dp_bridge), GFP_KERNEL);
- if (!msm_dp_bridge)
- return -ENOMEM;
+ msm_dp_bridge = devm_drm_bridge_alloc(dev->dev, struct msm_dp_bridge, bridge,
+ msm_dp_display->is_edp ? &msm_edp_bridge_ops :
+ &msm_dp_bridge_ops);
+ if (IS_ERR(msm_dp_bridge))
+ return PTR_ERR(msm_dp_bridge);
msm_dp_bridge->msm_dp_display = msm_dp_display;
bridge = &msm_dp_bridge->bridge;
- bridge->funcs = msm_dp_display->is_edp ? &msm_edp_bridge_ops : &msm_dp_bridge_ops;
bridge->type = msm_dp_display->connector_type;
bridge->ycbcr_420_allowed = yuv_supported;
--
2.49.0
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH v2 17/34] drm/msm/dsi: convert to devm_drm_bridge_alloc() API
[not found] <20250424-drm-bridge-convert-to-alloc-api-v2-0-8f91a404d86b@bootlin.com>
` (14 preceding siblings ...)
2025-04-24 18:59 ` [PATCH v2 16/34] drm/msm/dp: " Luca Ceresoli
@ 2025-04-24 18:59 ` Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 18/34] drm/msm/hdmi: " Luca Ceresoli
` (16 subsequent siblings)
32 siblings, 0 replies; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-24 18:59 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Luca Ceresoli,
Dmitry Baryshkov, Abhinav Kumar, Marijn Suijten, Rob Clark,
Sean Paul
This is the new API for allocating DRM bridges.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Cc: Abhinav Kumar <quic_abhinavk@quicinc.com>
Cc: Marijn Suijten <marijn.suijten@somainline.org>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Sean Paul <sean@poorly.run>
---
drivers/gpu/drm/msm/dsi/dsi_manager.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c
index 72ada9f2f043d2278e3ff2ff499fb52502330c68..ca400924d4eea89732905997d087e442ba9f336e 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
@@ -462,15 +462,14 @@ int msm_dsi_manager_connector_init(struct msm_dsi *msm_dsi,
struct drm_connector *connector;
int ret;
- dsi_bridge = devm_kzalloc(msm_dsi->dev->dev,
- sizeof(*dsi_bridge), GFP_KERNEL);
- if (!dsi_bridge)
- return -ENOMEM;
+ dsi_bridge = devm_drm_bridge_alloc(msm_dsi->dev->dev, struct dsi_bridge, base,
+ &dsi_mgr_bridge_funcs);
+ if (IS_ERR(dsi_bridge))
+ return PTR_ERR(dsi_bridge);
dsi_bridge->id = msm_dsi->id;
bridge = &dsi_bridge->base;
- bridge->funcs = &dsi_mgr_bridge_funcs;
ret = devm_drm_bridge_add(msm_dsi->dev->dev, bridge);
if (ret)
--
2.49.0
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH v2 18/34] drm/msm/hdmi: convert to devm_drm_bridge_alloc() API
[not found] <20250424-drm-bridge-convert-to-alloc-api-v2-0-8f91a404d86b@bootlin.com>
` (15 preceding siblings ...)
2025-04-24 18:59 ` [PATCH v2 17/34] drm/msm/dsi: " Luca Ceresoli
@ 2025-04-24 18:59 ` Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 19/34] drm/omap: dss: dpi: " Luca Ceresoli
` (15 subsequent siblings)
32 siblings, 0 replies; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-24 18:59 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Luca Ceresoli,
Dmitry Baryshkov, Abhinav Kumar, Marijn Suijten, Rob Clark,
Sean Paul
This is the new API for allocating DRM bridges.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Cc: Abhinav Kumar <quic_abhinavk@quicinc.com>
Cc: Marijn Suijten <marijn.suijten@somainline.org>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Sean Paul <sean@poorly.run>
---
drivers/gpu/drm/msm/hdmi/hdmi_bridge.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c
index ab6c8bc4a30b681f7de8ca7031f833795d1f7d94..7f71956806a25a1ab23293284da83ed4a8759c98 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c
+++ b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c
@@ -498,16 +498,15 @@ int msm_hdmi_bridge_init(struct hdmi *hdmi)
struct hdmi_bridge *hdmi_bridge;
int ret;
- hdmi_bridge = devm_kzalloc(hdmi->dev->dev,
- sizeof(*hdmi_bridge), GFP_KERNEL);
- if (!hdmi_bridge)
- return -ENOMEM;
+ hdmi_bridge = devm_drm_bridge_alloc(hdmi->dev->dev, struct hdmi_bridge, base,
+ &msm_hdmi_bridge_funcs);
+ if (IS_ERR(hdmi_bridge))
+ return PTR_ERR(hdmi_bridge);
hdmi_bridge->hdmi = hdmi;
INIT_WORK(&hdmi_bridge->hpd_work, msm_hdmi_hotplug_work);
bridge = &hdmi_bridge->base;
- bridge->funcs = &msm_hdmi_bridge_funcs;
bridge->ddc = hdmi->i2c;
bridge->type = DRM_MODE_CONNECTOR_HDMIA;
bridge->vendor = "Qualcomm";
--
2.49.0
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH v2 19/34] drm/omap: dss: dpi: convert to devm_drm_bridge_alloc() API
[not found] <20250424-drm-bridge-convert-to-alloc-api-v2-0-8f91a404d86b@bootlin.com>
` (16 preceding siblings ...)
2025-04-24 18:59 ` [PATCH v2 18/34] drm/msm/hdmi: " Luca Ceresoli
@ 2025-04-24 18:59 ` Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 20/34] drm/omap: dss: dsi: " Luca Ceresoli
` (14 subsequent siblings)
32 siblings, 0 replies; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-24 18:59 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Luca Ceresoli,
Rob Herring (Arm), Helge Deller, Kuninori Morimoto,
Tomi Valkeinen
This is the new API for allocating DRM bridges.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Cc: "Rob Herring (Arm)" <robh@kernel.org>
Cc: Helge Deller <deller@gmx.de>
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
drivers/gpu/drm/omapdrm/dss/dpi.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/omapdrm/dss/dpi.c b/drivers/gpu/drm/omapdrm/dss/dpi.c
index 6eff97a091602f6d137095b3b7bf54fce17e8d3e..9f86db774c395db7e3396cbf2694748fc23c309d 100644
--- a/drivers/gpu/drm/omapdrm/dss/dpi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dpi.c
@@ -562,7 +562,6 @@ static const struct drm_bridge_funcs dpi_bridge_funcs = {
static void dpi_bridge_init(struct dpi_data *dpi)
{
- dpi->bridge.funcs = &dpi_bridge_funcs;
dpi->bridge.of_node = dpi->pdev->dev.of_node;
dpi->bridge.type = DRM_MODE_CONNECTOR_DPI;
@@ -707,9 +706,9 @@ int dpi_init_port(struct dss_device *dss, struct platform_device *pdev,
u32 datalines;
int r;
- dpi = devm_kzalloc(&pdev->dev, sizeof(*dpi), GFP_KERNEL);
- if (!dpi)
- return -ENOMEM;
+ dpi = devm_drm_bridge_alloc(&pdev->dev, struct dpi_data, bridge, &dpi_bridge_funcs);
+ if (IS_ERR(dpi))
+ return PTR_ERR(dpi);
ep = of_graph_get_next_port_endpoint(port, NULL);
if (!ep)
--
2.49.0
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH v2 20/34] drm/omap: dss: dsi: convert to devm_drm_bridge_alloc() API
[not found] <20250424-drm-bridge-convert-to-alloc-api-v2-0-8f91a404d86b@bootlin.com>
` (17 preceding siblings ...)
2025-04-24 18:59 ` [PATCH v2 19/34] drm/omap: dss: dpi: " Luca Ceresoli
@ 2025-04-24 18:59 ` Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 21/34] drm/omap: dss: hdmi4: " Luca Ceresoli
` (13 subsequent siblings)
32 siblings, 0 replies; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-24 18:59 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Luca Ceresoli,
Tomi Valkeinen
This is the new API for allocating DRM bridges.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Cc: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
drivers/gpu/drm/omapdrm/dss/dsi.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 91ee63bfe0bc73e28877d0383812225867e167a4..b129e5a8d791507098c7b8d1bc54f54c4b453954 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -4701,7 +4701,6 @@ static const struct drm_bridge_funcs dsi_bridge_funcs = {
static void dsi_bridge_init(struct dsi_data *dsi)
{
- dsi->bridge.funcs = &dsi_bridge_funcs;
dsi->bridge.of_node = dsi->host.dev->of_node;
dsi->bridge.type = DRM_MODE_CONNECTOR_DSI;
@@ -4894,9 +4893,9 @@ static int dsi_probe(struct platform_device *pdev)
unsigned int i;
int r;
- dsi = devm_kzalloc(dev, sizeof(*dsi), GFP_KERNEL);
- if (!dsi)
- return -ENOMEM;
+ dsi = devm_drm_bridge_alloc(dev, struct dsi_data, bridge, &dsi_bridge_funcs);
+ if (IS_ERR(dsi))
+ return PTR_ERR(dsi);
dsi->dev = dev;
dev_set_drvdata(dev, dsi);
--
2.49.0
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH v2 21/34] drm/omap: dss: hdmi4: convert to devm_drm_bridge_alloc() API
[not found] <20250424-drm-bridge-convert-to-alloc-api-v2-0-8f91a404d86b@bootlin.com>
` (18 preceding siblings ...)
2025-04-24 18:59 ` [PATCH v2 20/34] drm/omap: dss: dsi: " Luca Ceresoli
@ 2025-04-24 18:59 ` Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 22/34] drm/omap: dss: hdmi5: " Luca Ceresoli
` (12 subsequent siblings)
32 siblings, 0 replies; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-24 18:59 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Luca Ceresoli,
Tomi Valkeinen
This is the new API for allocating DRM bridges.
Switching from a non-devm to a devm allocation allows removing the kfree()
in the remove function and in the probe error management code, and as a
consequence to simplify the code flow by removing now unnecessary gotos.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Cc: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
drivers/gpu/drm/omapdrm/dss/hdmi4.c | 26 ++++++++++----------------
1 file changed, 10 insertions(+), 16 deletions(-)
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
index a3b22952fdc32b5899dae82d413108c5c0a1c3c8..3cd612af24498b057c33eaecb3d43c8df76cd23e 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
@@ -505,7 +505,6 @@ static const struct drm_bridge_funcs hdmi4_bridge_funcs = {
static void hdmi4_bridge_init(struct omap_hdmi *hdmi)
{
- hdmi->bridge.funcs = &hdmi4_bridge_funcs;
hdmi->bridge.of_node = hdmi->pdev->dev.of_node;
hdmi->bridge.ops = DRM_BRIDGE_OP_EDID;
hdmi->bridge.type = DRM_MODE_CONNECTOR_HDMIA;
@@ -761,9 +760,9 @@ static int hdmi4_probe(struct platform_device *pdev)
int irq;
int r;
- hdmi = kzalloc(sizeof(*hdmi), GFP_KERNEL);
- if (!hdmi)
- return -ENOMEM;
+ hdmi = devm_drm_bridge_alloc(&pdev->dev, struct omap_hdmi, bridge, &hdmi4_bridge_funcs);
+ if (IS_ERR(hdmi))
+ return PTR_ERR(hdmi);
hdmi->pdev = pdev;
@@ -774,25 +773,24 @@ static int hdmi4_probe(struct platform_device *pdev)
r = hdmi4_probe_of(hdmi);
if (r)
- goto err_free;
+ return r;
r = hdmi_wp_init(pdev, &hdmi->wp, 4);
if (r)
- goto err_free;
+ return r;
r = hdmi_phy_init(pdev, &hdmi->phy, 4);
if (r)
- goto err_free;
+ return r;
r = hdmi4_core_init(pdev, &hdmi->core);
if (r)
- goto err_free;
+ return r;
irq = platform_get_irq(pdev, 0);
if (irq < 0) {
DSSERR("platform_get_irq failed\n");
- r = -ENODEV;
- goto err_free;
+ return -ENODEV;
}
r = devm_request_threaded_irq(&pdev->dev, irq,
@@ -800,7 +798,7 @@ static int hdmi4_probe(struct platform_device *pdev)
IRQF_ONESHOT, "OMAP HDMI", hdmi);
if (r) {
DSSERR("HDMI IRQ request failed\n");
- goto err_free;
+ return r;
}
hdmi->vdda_reg = devm_regulator_get(&pdev->dev, "vdda");
@@ -808,7 +806,7 @@ static int hdmi4_probe(struct platform_device *pdev)
r = PTR_ERR(hdmi->vdda_reg);
if (r != -EPROBE_DEFER)
DSSERR("can't get VDDA regulator\n");
- goto err_free;
+ return r;
}
pm_runtime_enable(&pdev->dev);
@@ -827,8 +825,6 @@ static int hdmi4_probe(struct platform_device *pdev)
hdmi4_uninit_output(hdmi);
err_pm_disable:
pm_runtime_disable(&pdev->dev);
-err_free:
- kfree(hdmi);
return r;
}
@@ -841,8 +837,6 @@ static void hdmi4_remove(struct platform_device *pdev)
hdmi4_uninit_output(hdmi);
pm_runtime_disable(&pdev->dev);
-
- kfree(hdmi);
}
static const struct of_device_id hdmi_of_match[] = {
--
2.49.0
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH v2 22/34] drm/omap: dss: hdmi5: convert to devm_drm_bridge_alloc() API
[not found] <20250424-drm-bridge-convert-to-alloc-api-v2-0-8f91a404d86b@bootlin.com>
` (19 preceding siblings ...)
2025-04-24 18:59 ` [PATCH v2 21/34] drm/omap: dss: hdmi4: " Luca Ceresoli
@ 2025-04-24 18:59 ` Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 23/34] drm/omap: dss: sdi: " Luca Ceresoli
` (11 subsequent siblings)
32 siblings, 0 replies; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-24 18:59 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Luca Ceresoli,
Tomi Valkeinen
This is the new API for allocating DRM bridges.
Switching from a non-devm to a devm allocation allows removing the kfree()
in the remove function and in the probe error management code, and as a
consequence to simplify the code flow by removing now unnecessary gotos.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Cc: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
drivers/gpu/drm/omapdrm/dss/hdmi5.c | 26 ++++++++++----------------
1 file changed, 10 insertions(+), 16 deletions(-)
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5.c b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
index 0c98444d39a93d8336b4d8dbd45aa4521181c3b4..5636b3dfec1c9581118b20adecd268c03e882efb 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi5.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
@@ -480,7 +480,6 @@ static const struct drm_bridge_funcs hdmi5_bridge_funcs = {
static void hdmi5_bridge_init(struct omap_hdmi *hdmi)
{
- hdmi->bridge.funcs = &hdmi5_bridge_funcs;
hdmi->bridge.of_node = hdmi->pdev->dev.of_node;
hdmi->bridge.ops = DRM_BRIDGE_OP_EDID;
hdmi->bridge.type = DRM_MODE_CONNECTOR_HDMIA;
@@ -727,9 +726,9 @@ static int hdmi5_probe(struct platform_device *pdev)
int irq;
int r;
- hdmi = kzalloc(sizeof(*hdmi), GFP_KERNEL);
- if (!hdmi)
- return -ENOMEM;
+ hdmi = devm_drm_bridge_alloc(&pdev->dev, struct omap_hdmi, bridge, &hdmi5_bridge_funcs);
+ if (IS_ERR(hdmi))
+ return PTR_ERR(hdmi);
hdmi->pdev = pdev;
@@ -740,25 +739,24 @@ static int hdmi5_probe(struct platform_device *pdev)
r = hdmi5_probe_of(hdmi);
if (r)
- goto err_free;
+ return r;
r = hdmi_wp_init(pdev, &hdmi->wp, 5);
if (r)
- goto err_free;
+ return r;
r = hdmi_phy_init(pdev, &hdmi->phy, 5);
if (r)
- goto err_free;
+ return r;
r = hdmi5_core_init(pdev, &hdmi->core);
if (r)
- goto err_free;
+ return r;
irq = platform_get_irq(pdev, 0);
if (irq < 0) {
DSSERR("platform_get_irq failed\n");
- r = -ENODEV;
- goto err_free;
+ return -ENODEV;
}
r = devm_request_threaded_irq(&pdev->dev, irq,
@@ -766,7 +764,7 @@ static int hdmi5_probe(struct platform_device *pdev)
IRQF_ONESHOT, "OMAP HDMI", hdmi);
if (r) {
DSSERR("HDMI IRQ request failed\n");
- goto err_free;
+ return r;
}
hdmi->vdda_reg = devm_regulator_get(&pdev->dev, "vdda");
@@ -774,7 +772,7 @@ static int hdmi5_probe(struct platform_device *pdev)
r = PTR_ERR(hdmi->vdda_reg);
if (r != -EPROBE_DEFER)
DSSERR("can't get VDDA regulator\n");
- goto err_free;
+ return r;
}
pm_runtime_enable(&pdev->dev);
@@ -793,8 +791,6 @@ static int hdmi5_probe(struct platform_device *pdev)
hdmi5_uninit_output(hdmi);
err_pm_disable:
pm_runtime_disable(&pdev->dev);
-err_free:
- kfree(hdmi);
return r;
}
@@ -807,8 +803,6 @@ static void hdmi5_remove(struct platform_device *pdev)
hdmi5_uninit_output(hdmi);
pm_runtime_disable(&pdev->dev);
-
- kfree(hdmi);
}
static const struct of_device_id hdmi_of_match[] = {
--
2.49.0
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH v2 23/34] drm/omap: dss: sdi: convert to devm_drm_bridge_alloc() API
[not found] <20250424-drm-bridge-convert-to-alloc-api-v2-0-8f91a404d86b@bootlin.com>
` (20 preceding siblings ...)
2025-04-24 18:59 ` [PATCH v2 22/34] drm/omap: dss: hdmi5: " Luca Ceresoli
@ 2025-04-24 18:59 ` Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 24/34] drm/omap: dss: venc: " Luca Ceresoli
` (10 subsequent siblings)
32 siblings, 0 replies; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-24 18:59 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Luca Ceresoli,
Rob Herring (Arm), Kuninori Morimoto, Tomi Valkeinen
This is the new API for allocating DRM bridges.
Switching from a non-devm to a devm allocation allows removing the kfree()
in the remove function and in the probe error management code, and as a
consequence to simplify the code flow by removing now unnecessary gotos.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Cc: "Rob Herring (Arm)" <robh@kernel.org>
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
drivers/gpu/drm/omapdrm/dss/sdi.c | 25 ++++++++-----------------
1 file changed, 8 insertions(+), 17 deletions(-)
diff --git a/drivers/gpu/drm/omapdrm/dss/sdi.c b/drivers/gpu/drm/omapdrm/dss/sdi.c
index e78826e4b560a2b9af2d8a5a38e181bd3e44d250..df4cbc683e2ca27ef5fc45f79b77dcdcd9ca529a 100644
--- a/drivers/gpu/drm/omapdrm/dss/sdi.c
+++ b/drivers/gpu/drm/omapdrm/dss/sdi.c
@@ -284,7 +284,6 @@ static const struct drm_bridge_funcs sdi_bridge_funcs = {
static void sdi_bridge_init(struct sdi_device *sdi)
{
- sdi->bridge.funcs = &sdi_bridge_funcs;
sdi->bridge.of_node = sdi->pdev->dev.of_node;
sdi->bridge.type = DRM_MODE_CONNECTOR_LVDS;
@@ -344,21 +343,19 @@ int sdi_init_port(struct dss_device *dss, struct platform_device *pdev,
u32 datapairs;
int r;
- sdi = kzalloc(sizeof(*sdi), GFP_KERNEL);
- if (!sdi)
- return -ENOMEM;
+ sdi = devm_drm_bridge_alloc(&pdev->dev, struct sdi_device, bridge, &sdi_bridge_funcs);
+ if (IS_ERR(sdi))
+ return PTR_ERR(sdi);
ep = of_graph_get_next_port_endpoint(port, NULL);
- if (!ep) {
- r = 0;
- goto err_free;
- }
+ if (!ep)
+ return 0;
r = of_property_read_u32(ep, "datapairs", &datapairs);
of_node_put(ep);
if (r) {
DSSERR("failed to parse datapairs\n");
- goto err_free;
+ return r;
}
sdi->datapairs = datapairs;
@@ -372,19 +369,14 @@ int sdi_init_port(struct dss_device *dss, struct platform_device *pdev,
r = PTR_ERR(sdi->vdds_sdi_reg);
if (r != -EPROBE_DEFER)
DSSERR("can't get VDDS_SDI regulator\n");
- goto err_free;
+ return r;
}
r = sdi_init_output(sdi);
if (r)
- goto err_free;
+ return r;
return 0;
-
-err_free:
- kfree(sdi);
-
- return r;
}
void sdi_uninit_port(struct device_node *port)
@@ -395,5 +387,4 @@ void sdi_uninit_port(struct device_node *port)
return;
sdi_uninit_output(sdi);
- kfree(sdi);
}
--
2.49.0
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH v2 24/34] drm/omap: dss: venc: convert to devm_drm_bridge_alloc() API
[not found] <20250424-drm-bridge-convert-to-alloc-api-v2-0-8f91a404d86b@bootlin.com>
` (21 preceding siblings ...)
2025-04-24 18:59 ` [PATCH v2 23/34] drm/omap: dss: sdi: " Luca Ceresoli
@ 2025-04-24 18:59 ` Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 25/34] drm/rcar-du: dsi: " Luca Ceresoli
` (9 subsequent siblings)
32 siblings, 0 replies; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-24 18:59 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Luca Ceresoli,
Tomi Valkeinen
This is the new API for allocating DRM bridges.
Switching from a non-devm to a devm allocation allows removing the kfree()
in the remove function and in the probe error management code, and as a
consequence to simplify the code flow by removing now unnecessary gotos.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Cc: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
drivers/gpu/drm/omapdrm/dss/venc.c | 23 ++++++++---------------
1 file changed, 8 insertions(+), 15 deletions(-)
diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c b/drivers/gpu/drm/omapdrm/dss/venc.c
index 50349518eda1630400529caf27ca4469bb09fc82..9b5d53dc361e654a2e4009c3c81b726f9ef76ced 100644
--- a/drivers/gpu/drm/omapdrm/dss/venc.c
+++ b/drivers/gpu/drm/omapdrm/dss/venc.c
@@ -664,7 +664,6 @@ static const struct drm_bridge_funcs venc_bridge_funcs = {
static void venc_bridge_init(struct venc_device *venc)
{
- venc->bridge.funcs = &venc_bridge_funcs;
venc->bridge.of_node = venc->pdev->dev.of_node;
venc->bridge.ops = DRM_BRIDGE_OP_MODES;
venc->bridge.type = DRM_MODE_CONNECTOR_SVIDEO;
@@ -809,9 +808,9 @@ static int venc_probe(struct platform_device *pdev)
struct venc_device *venc;
int r;
- venc = kzalloc(sizeof(*venc), GFP_KERNEL);
- if (!venc)
- return -ENOMEM;
+ venc = devm_drm_bridge_alloc(&pdev->dev, struct venc_device, bridge, &venc_bridge_funcs);
+ if (IS_ERR(venc))
+ return PTR_ERR(venc);
venc->pdev = pdev;
@@ -824,26 +823,24 @@ static int venc_probe(struct platform_device *pdev)
venc->config = &venc_config_pal_trm;
venc->base = devm_platform_ioremap_resource(pdev, 0);
- if (IS_ERR(venc->base)) {
- r = PTR_ERR(venc->base);
- goto err_free;
- }
+ if (IS_ERR(venc->base))
+ return PTR_ERR(venc->base);
venc->vdda_dac_reg = devm_regulator_get(&pdev->dev, "vdda");
if (IS_ERR(venc->vdda_dac_reg)) {
r = PTR_ERR(venc->vdda_dac_reg);
if (r != -EPROBE_DEFER)
DSSERR("can't get VDDA_DAC regulator\n");
- goto err_free;
+ return r;
}
r = venc_get_clocks(venc);
if (r)
- goto err_free;
+ return r;
r = venc_probe_of(venc);
if (r)
- goto err_free;
+ return r;
pm_runtime_enable(&pdev->dev);
@@ -861,8 +858,6 @@ static int venc_probe(struct platform_device *pdev)
venc_uninit_output(venc);
err_pm_disable:
pm_runtime_disable(&pdev->dev);
-err_free:
- kfree(venc);
return r;
}
@@ -875,8 +870,6 @@ static void venc_remove(struct platform_device *pdev)
venc_uninit_output(venc);
pm_runtime_disable(&pdev->dev);
-
- kfree(venc);
}
static __maybe_unused int venc_runtime_suspend(struct device *dev)
--
2.49.0
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH v2 25/34] drm/rcar-du: dsi: convert to devm_drm_bridge_alloc() API
[not found] <20250424-drm-bridge-convert-to-alloc-api-v2-0-8f91a404d86b@bootlin.com>
` (22 preceding siblings ...)
2025-04-24 18:59 ` [PATCH v2 24/34] drm/omap: dss: venc: " Luca Ceresoli
@ 2025-04-24 18:59 ` Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 26/34] drm/bridge: stm_lvds: " Luca Ceresoli
` (8 subsequent siblings)
32 siblings, 0 replies; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-24 18:59 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Luca Ceresoli,
Kieran Bingham, Laurent Pinchart, Tomi Valkeinen
This is the new API for allocating DRM bridges.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Cc: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Cc: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
---
drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c b/drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c
index 7ab8be46c7f6547f29b4d45af7ac704283da9dcd..1af4c73f7a887712aef8c8176b0d0338d9ca9727 100644
--- a/drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c
+++ b/drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c
@@ -918,7 +918,6 @@ static int rcar_mipi_dsi_host_attach(struct mipi_dsi_host *host,
}
/* Initialize the DRM bridge. */
- dsi->bridge.funcs = &rcar_mipi_dsi_bridge_ops;
dsi->bridge.of_node = dsi->dev->of_node;
drm_bridge_add(&dsi->bridge);
@@ -1004,9 +1003,10 @@ static int rcar_mipi_dsi_probe(struct platform_device *pdev)
struct rcar_mipi_dsi *dsi;
int ret;
- dsi = devm_kzalloc(&pdev->dev, sizeof(*dsi), GFP_KERNEL);
- if (dsi == NULL)
- return -ENOMEM;
+ dsi = devm_drm_bridge_alloc(&pdev->dev, struct rcar_mipi_dsi, bridge,
+ &rcar_mipi_dsi_bridge_ops);
+ if (IS_ERR(dsi))
+ return PTR_ERR(dsi);
platform_set_drvdata(pdev, dsi);
--
2.49.0
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH v2 26/34] drm/bridge: stm_lvds: convert to devm_drm_bridge_alloc() API
[not found] <20250424-drm-bridge-convert-to-alloc-api-v2-0-8f91a404d86b@bootlin.com>
` (23 preceding siblings ...)
2025-04-24 18:59 ` [PATCH v2 25/34] drm/rcar-du: dsi: " Luca Ceresoli
@ 2025-04-24 18:59 ` Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 27/34] drm/vc4: " Luca Ceresoli
` (7 subsequent siblings)
32 siblings, 0 replies; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-24 18:59 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Luca Ceresoli,
Alexandre Torgue, Maxime Coquelin, Philippe Cornu,
Raphael Gallais-Pou, Yannick Fertre
This is the new API for allocating DRM bridges.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Philippe Cornu <philippe.cornu@foss.st.com>
Cc: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
Cc: Yannick Fertre <yannick.fertre@foss.st.com>
---
drivers/gpu/drm/stm/lvds.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/stm/lvds.c b/drivers/gpu/drm/stm/lvds.c
index a3ae9a93ce6670eb2c4dd36b3e572fcbca791a1c..07788e8d3d8302a3951e97d64736b721033998d3 100644
--- a/drivers/gpu/drm/stm/lvds.c
+++ b/drivers/gpu/drm/stm/lvds.c
@@ -1049,9 +1049,9 @@ static int lvds_probe(struct platform_device *pdev)
dev_dbg(dev, "Probing LVDS driver...\n");
- lvds = devm_kzalloc(dev, sizeof(*lvds), GFP_KERNEL);
- if (!lvds)
- return -ENOMEM;
+ lvds = devm_drm_bridge_alloc(dev, struct stm_lvds, lvds_bridge, &lvds_bridge_funcs);
+ if (IS_ERR(lvds))
+ return PTR_ERR(lvds);
lvds->dev = dev;
@@ -1164,7 +1164,6 @@ static int lvds_probe(struct platform_device *pdev)
goto err_lvds_probe;
}
- lvds->lvds_bridge.funcs = &lvds_bridge_funcs;
lvds->lvds_bridge.of_node = dev->of_node;
lvds->hw_version = lvds_read(lvds, LVDS_VERR);
--
2.49.0
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH v2 27/34] drm/vc4: convert to devm_drm_bridge_alloc() API
[not found] <20250424-drm-bridge-convert-to-alloc-api-v2-0-8f91a404d86b@bootlin.com>
` (24 preceding siblings ...)
2025-04-24 18:59 ` [PATCH v2 26/34] drm/bridge: stm_lvds: " Luca Ceresoli
@ 2025-04-24 18:59 ` Luca Ceresoli
2025-04-28 15:45 ` Dave Stevenson
2025-04-24 18:59 ` [PATCH v2 28/34] drm/sti: dvo: " Luca Ceresoli
` (6 subsequent siblings)
32 siblings, 1 reply; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-24 18:59 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Luca Ceresoli,
Maíra Canal, Dave Stevenson, Raspberry Pi Kernel Maintenance
This is the new API for allocating DRM bridges.
This driver already implements refcounting of the struct vc4_dsi, which
embeds struct drm_bridge. Now this is a duplicate of the refcounting
implemented by the DRM bridge core, so convert the vc4_dsi_get/put() calls
into drm_bridge_get/put() calls and get rid of the driver-specific
refcounting implementation.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Cc: "Maíra Canal" <mcanal@igalia.com>
Cc: Dave Stevenson <dave.stevenson@raspberrypi.com>
Cc: Raspberry Pi Kernel Maintenance <kernel-list@raspberrypi.com>
Changed in v2:
- fix error code checking
---
drivers/gpu/drm/vc4/vc4_dsi.c | 34 +++++-----------------------------
1 file changed, 5 insertions(+), 29 deletions(-)
diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c
index efc6f6078b026764c59cfb2a33b28a88b7018c3a..458e5d9879645f18bcbcaeeb71b5f1038f9581da 100644
--- a/drivers/gpu/drm/vc4/vc4_dsi.c
+++ b/drivers/gpu/drm/vc4/vc4_dsi.c
@@ -552,8 +552,6 @@ struct vc4_dsi {
struct vc4_encoder encoder;
struct mipi_dsi_host dsi_host;
- struct kref kref;
-
struct platform_device *pdev;
struct drm_bridge *out_bridge;
@@ -1622,29 +1620,11 @@ static void vc4_dsi_dma_chan_release(void *ptr)
dsi->reg_dma_chan = NULL;
}
-static void vc4_dsi_release(struct kref *kref)
-{
- struct vc4_dsi *dsi =
- container_of(kref, struct vc4_dsi, kref);
-
- kfree(dsi);
-}
-
-static void vc4_dsi_get(struct vc4_dsi *dsi)
-{
- kref_get(&dsi->kref);
-}
-
-static void vc4_dsi_put(struct vc4_dsi *dsi)
-{
- kref_put(&dsi->kref, &vc4_dsi_release);
-}
-
static void vc4_dsi_release_action(struct drm_device *drm, void *ptr)
{
struct vc4_dsi *dsi = ptr;
- vc4_dsi_put(dsi);
+ drm_bridge_put(&dsi->bridge);
}
static int vc4_dsi_bind(struct device *dev, struct device *master, void *data)
@@ -1655,7 +1635,7 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data)
struct drm_encoder *encoder = &dsi->encoder.base;
int ret;
- vc4_dsi_get(dsi);
+ drm_bridge_get(&dsi->bridge);
ret = drmm_add_action_or_reset(drm, vc4_dsi_release_action, dsi);
if (ret)
@@ -1810,15 +1790,12 @@ static int vc4_dsi_dev_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct vc4_dsi *dsi;
- dsi = kzalloc(sizeof(*dsi), GFP_KERNEL);
- if (!dsi)
- return -ENOMEM;
+ dsi = devm_drm_bridge_alloc(&pdev->dev, struct vc4_dsi, bridge, &vc4_dsi_bridge_funcs);
+ if (IS_ERR(dsi))
+ return PTR_ERR(dsi);
dev_set_drvdata(dev, dsi);
- kref_init(&dsi->kref);
-
dsi->pdev = pdev;
- dsi->bridge.funcs = &vc4_dsi_bridge_funcs;
#ifdef CONFIG_OF
dsi->bridge.of_node = dev->of_node;
#endif
@@ -1836,7 +1813,6 @@ static void vc4_dsi_dev_remove(struct platform_device *pdev)
struct vc4_dsi *dsi = dev_get_drvdata(dev);
mipi_dsi_host_unregister(&dsi->dsi_host);
- vc4_dsi_put(dsi);
}
struct platform_driver vc4_dsi_driver = {
--
2.49.0
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH v2 28/34] drm/sti: dvo: convert to devm_drm_bridge_alloc() API
[not found] <20250424-drm-bridge-convert-to-alloc-api-v2-0-8f91a404d86b@bootlin.com>
` (25 preceding siblings ...)
2025-04-24 18:59 ` [PATCH v2 27/34] drm/vc4: " Luca Ceresoli
@ 2025-04-24 18:59 ` Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 29/34] drm: zynqmp_dp: " Luca Ceresoli
` (5 subsequent siblings)
32 siblings, 0 replies; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-24 18:59 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Luca Ceresoli,
Alain Volmat, Raphael Gallais-Pou
This is the new API for allocating DRM bridges.
This driver allocates the DRM bridge separately from the main driver
private struct, which prevents using the new devm_drm_bridge_alloc()
API. Simplify the code by replacing the struct drm_bridge pointer with an
embedded struct drm_bridge inside the private struct, to make use of the
new API with the same code flow.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Cc: Alain Volmat <alain.volmat@foss.st.com>
Cc: Raphael Gallais-Pou <rgallaispou@gmail.com>
Changed in v2:
- fix typos in commit message
---
drivers/gpu/drm/sti/sti_dvo.c | 29 +++++++++++------------------
1 file changed, 11 insertions(+), 18 deletions(-)
diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
index 74a1eef4674eeabc445b53b380e325f785242024..7484d3c3f4ed5fac7eab408e30cbe2f6b87f27e5 100644
--- a/drivers/gpu/drm/sti/sti_dvo.c
+++ b/drivers/gpu/drm/sti/sti_dvo.c
@@ -97,7 +97,7 @@ struct sti_dvo {
struct dvo_config *config;
bool enabled;
struct drm_encoder *encoder;
- struct drm_bridge *bridge;
+ struct drm_bridge bridge;
};
struct sti_dvo_connector {
@@ -439,7 +439,6 @@ static int sti_dvo_bind(struct device *dev, struct device *master, void *data)
struct drm_encoder *encoder;
struct sti_dvo_connector *connector;
struct drm_connector *drm_connector;
- struct drm_bridge *bridge;
int err;
/* Set the drm device handle */
@@ -455,20 +454,14 @@ static int sti_dvo_bind(struct device *dev, struct device *master, void *data)
connector->dvo = dvo;
- bridge = devm_kzalloc(dev, sizeof(*bridge), GFP_KERNEL);
- if (!bridge)
- return -ENOMEM;
-
- bridge->driver_private = dvo;
- bridge->funcs = &sti_dvo_bridge_funcs;
- bridge->of_node = dvo->dev.of_node;
- drm_bridge_add(bridge);
+ dvo->bridge.driver_private = dvo;
+ dvo->bridge.of_node = dvo->dev.of_node;
+ drm_bridge_add(&dvo->bridge);
- err = drm_bridge_attach(encoder, bridge, NULL, 0);
+ err = drm_bridge_attach(encoder, &dvo->bridge, NULL, 0);
if (err)
return err;
- dvo->bridge = bridge;
connector->encoder = encoder;
dvo->encoder = encoder;
@@ -490,7 +483,7 @@ static int sti_dvo_bind(struct device *dev, struct device *master, void *data)
return 0;
err_sysfs:
- drm_bridge_remove(bridge);
+ drm_bridge_remove(&dvo->bridge);
return -EINVAL;
}
@@ -499,7 +492,7 @@ static void sti_dvo_unbind(struct device *dev,
{
struct sti_dvo *dvo = dev_get_drvdata(dev);
- drm_bridge_remove(dvo->bridge);
+ drm_bridge_remove(&dvo->bridge);
}
static const struct component_ops sti_dvo_ops = {
@@ -515,10 +508,10 @@ static int sti_dvo_probe(struct platform_device *pdev)
DRM_INFO("%s\n", __func__);
- dvo = devm_kzalloc(dev, sizeof(*dvo), GFP_KERNEL);
- if (!dvo) {
- DRM_ERROR("Failed to allocate memory for DVO\n");
- return -ENOMEM;
+ dvo = devm_drm_bridge_alloc(dev, struct sti_dvo, bridge, &sti_dvo_bridge_funcs);
+ if (IS_ERR(dvo)) {
+ DRM_ERROR("Failed to allocate DVO\n");
+ return PTR_ERR(dvo);
}
dvo->dev = pdev->dev;
--
2.49.0
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH v2 29/34] drm: zynqmp_dp: convert to devm_drm_bridge_alloc() API
[not found] <20250424-drm-bridge-convert-to-alloc-api-v2-0-8f91a404d86b@bootlin.com>
` (26 preceding siblings ...)
2025-04-24 18:59 ` [PATCH v2 28/34] drm/sti: dvo: " Luca Ceresoli
@ 2025-04-24 18:59 ` Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 30/34] drm/bridge: imx8qxp-pixel-combiner: " Luca Ceresoli
` (4 subsequent siblings)
32 siblings, 0 replies; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-24 18:59 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Luca Ceresoli,
Laurent Pinchart, Michal Simek, Tomi Valkeinen
This is the new API for allocating DRM bridges.
This driver has a peculiar structure. zynqmp_dpsub.c is the actual driver,
which delegates to a submodule (zynqmp_dp.c) the allocation of a
sub-structure embedding the drm_bridge and its initialization, however it
does not delegate the drm_bridge_add(). Hence, following carefully the code
flow, it is correct to change the allocation function and .funcs assignment
in the submodule, while the drm_bridge_add() is not in that submodule.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Michal Simek <michal.simek@amd.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Changes in v2:
- rebased on current drm-misc-next
- remove the kfree() calls too, as we are converting from kzalloc+kfree,
not from devm_kzalloc
---
drivers/gpu/drm/xlnx/zynqmp_dp.c | 31 +++++++++++--------------------
drivers/gpu/drm/xlnx/zynqmp_dpsub.c | 1 -
2 files changed, 11 insertions(+), 21 deletions(-)
diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp.c b/drivers/gpu/drm/xlnx/zynqmp_dp.c
index 238cbb49963efa6e8cc737d8a6e76250f6531276..02e1feaa611596a24217136ee8ce7f5d2f1900a2 100644
--- a/drivers/gpu/drm/xlnx/zynqmp_dp.c
+++ b/drivers/gpu/drm/xlnx/zynqmp_dp.c
@@ -2439,9 +2439,9 @@ int zynqmp_dp_probe(struct zynqmp_dpsub *dpsub)
struct zynqmp_dp *dp;
int ret;
- dp = kzalloc(sizeof(*dp), GFP_KERNEL);
- if (!dp)
- return -ENOMEM;
+ dp = devm_drm_bridge_alloc(&pdev->dev, struct zynqmp_dp, bridge, &zynqmp_dp_bridge_funcs);
+ if (IS_ERR(dp))
+ return PTR_ERR(dp);
dp->dev = &pdev->dev;
dp->dpsub = dpsub;
@@ -2454,31 +2454,25 @@ int zynqmp_dp_probe(struct zynqmp_dpsub *dpsub)
/* Acquire all resources (IOMEM, IRQ and PHYs). */
dp->iomem = devm_platform_ioremap_resource_byname(pdev, "dp");
- if (IS_ERR(dp->iomem)) {
- ret = PTR_ERR(dp->iomem);
- goto err_free;
- }
+ if (IS_ERR(dp->iomem))
+ return PTR_ERR(dp->iomem);
dp->irq = platform_get_irq(pdev, 0);
- if (dp->irq < 0) {
- ret = dp->irq;
- goto err_free;
- }
+ if (dp->irq < 0)
+ return dp->irq;
dp->reset = devm_reset_control_get(dp->dev, NULL);
- if (IS_ERR(dp->reset)) {
- ret = dev_err_probe(dp->dev, PTR_ERR(dp->reset),
+ if (IS_ERR(dp->reset))
+ return dev_err_probe(dp->dev, PTR_ERR(dp->reset),
"failed to get reset\n");
- goto err_free;
- }
ret = zynqmp_dp_reset(dp, true);
if (ret < 0)
- goto err_free;
+ return ret;
ret = zynqmp_dp_reset(dp, false);
if (ret < 0)
- goto err_free;
+ return ret;
ret = zynqmp_dp_phy_probe(dp);
if (ret)
@@ -2486,7 +2480,6 @@ int zynqmp_dp_probe(struct zynqmp_dpsub *dpsub)
/* Initialize the bridge. */
bridge = &dp->bridge;
- bridge->funcs = &zynqmp_dp_bridge_funcs;
bridge->ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID
| DRM_BRIDGE_OP_HPD;
bridge->type = DRM_MODE_CONNECTOR_DisplayPort;
@@ -2539,8 +2532,6 @@ int zynqmp_dp_probe(struct zynqmp_dpsub *dpsub)
zynqmp_dp_phy_exit(dp);
err_reset:
zynqmp_dp_reset(dp, true);
-err_free:
- kfree(dp);
return ret;
}
diff --git a/drivers/gpu/drm/xlnx/zynqmp_dpsub.c b/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
index 3a9544b97bc5311f9adeb57c08c837a04b6922fa..2764c4b17c5e49611db8adf41dd09e3134c2d524 100644
--- a/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
+++ b/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
@@ -180,7 +180,6 @@ static int zynqmp_dpsub_parse_dt(struct zynqmp_dpsub *dpsub)
void zynqmp_dpsub_release(struct zynqmp_dpsub *dpsub)
{
kfree(dpsub->disp);
- kfree(dpsub->dp);
kfree(dpsub);
}
--
2.49.0
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH v2 30/34] drm/bridge: imx8qxp-pixel-combiner: convert to devm_drm_bridge_alloc() API
[not found] <20250424-drm-bridge-convert-to-alloc-api-v2-0-8f91a404d86b@bootlin.com>
` (27 preceding siblings ...)
2025-04-24 18:59 ` [PATCH v2 29/34] drm: zynqmp_dp: " Luca Ceresoli
@ 2025-04-24 18:59 ` Luca Ceresoli
2025-04-29 2:10 ` Liu Ying
2025-04-24 18:59 ` [PATCH v2 31/34] drm/bridge: imx8*-ldb: " Luca Ceresoli
` (3 subsequent siblings)
32 siblings, 1 reply; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-24 18:59 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Luca Ceresoli, Liu Ying
This is the new API for allocating DRM bridges.
This driver embeds an array of channels in the main struct, and each
channel embeds a drm_bridge. This prevents dynamic, refcount-based
deallocation of the bridges.
To make the new, dynamic bridge allocation possible:
* change the array of channels into an array of channel pointers
* allocate each channel using devm_drm_bridge_alloc()
* adapt the code wherever using the channels
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Cc: Liu Ying <victor.liu@nxp.com>
---
drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c b/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c
index 1f6fd488e7039e943351006d3373009f0c15cb08..40a8a5a53a781137e722309ff91692cf90d881da 100644
--- a/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c
+++ b/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c
@@ -68,7 +68,7 @@ struct imx8qxp_pc_channel {
struct imx8qxp_pc {
struct device *dev;
- struct imx8qxp_pc_channel ch[2];
+ struct imx8qxp_pc_channel *ch[2];
struct clk *clk_apb;
void __iomem *base;
};
@@ -307,7 +307,14 @@ static int imx8qxp_pc_bridge_probe(struct platform_device *pdev)
goto free_child;
}
- ch = &pc->ch[i];
+ ch = devm_drm_bridge_alloc(dev, struct imx8qxp_pc_channel, bridge,
+ &imx8qxp_pc_bridge_funcs);
+ if (IS_ERR(ch)) {
+ ret = PTR_ERR(ch);
+ goto free_child;
+ }
+
+ pc->ch[i] = ch;
ch->pc = pc;
ch->stream_id = i;
@@ -333,7 +340,6 @@ static int imx8qxp_pc_bridge_probe(struct platform_device *pdev)
of_node_put(remote);
ch->bridge.driver_private = ch;
- ch->bridge.funcs = &imx8qxp_pc_bridge_funcs;
ch->bridge.of_node = child;
ch->is_available = true;
@@ -345,8 +351,8 @@ static int imx8qxp_pc_bridge_probe(struct platform_device *pdev)
free_child:
of_node_put(child);
- if (i == 1 && pc->ch[0].next_bridge)
- drm_bridge_remove(&pc->ch[0].bridge);
+ if (i == 1 && pc->ch[0]->next_bridge)
+ drm_bridge_remove(&pc->ch[0]->bridge);
pm_runtime_disable(dev);
return ret;
@@ -359,7 +365,7 @@ static void imx8qxp_pc_bridge_remove(struct platform_device *pdev)
int i;
for (i = 0; i < 2; i++) {
- ch = &pc->ch[i];
+ ch = pc->ch[i];
if (!ch->is_available)
continue;
--
2.49.0
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH v2 31/34] drm/bridge: imx8*-ldb: convert to devm_drm_bridge_alloc() API
[not found] <20250424-drm-bridge-convert-to-alloc-api-v2-0-8f91a404d86b@bootlin.com>
` (28 preceding siblings ...)
2025-04-24 18:59 ` [PATCH v2 30/34] drm/bridge: imx8qxp-pixel-combiner: " Luca Ceresoli
@ 2025-04-24 18:59 ` Luca Ceresoli
2025-04-29 2:35 ` Liu Ying
2025-04-24 18:59 ` [PATCH v2 32/34] drm/bridge: tc358767: " Luca Ceresoli
` (2 subsequent siblings)
32 siblings, 1 reply; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-24 18:59 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Luca Ceresoli, Liu Ying
This is the new API for allocating DRM bridges.
These two drivers are tangled together by the ldb_add_bridge_helper(), so
they are converted at once.
They also have a similar design, each embedding an array of channels in
their main struct, and each channel embeds a drm_bridge. This prevents
dynamic, refcount-based deallocation of the bridges.
To make the new, dynamic bridge allocation possible:
* change the array of channels into an array of channel pointers
* allocate each channel using devm_drm_bridge_alloc()
* adapt ldb_add_bridge_helper() to not set the funcs pointer
(now done by devm_drm_bridge_alloc())
* adapt the code wherever using the channels
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Cc: Liu Ying <victor.liu@nxp.com>
---
drivers/gpu/drm/bridge/imx/imx-ldb-helper.c | 4 +---
drivers/gpu/drm/bridge/imx/imx-ldb-helper.h | 3 +--
drivers/gpu/drm/bridge/imx/imx8qm-ldb.c | 32 ++++++++++++++++++-----------
drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c | 20 ++++++++++++------
4 files changed, 36 insertions(+), 23 deletions(-)
diff --git a/drivers/gpu/drm/bridge/imx/imx-ldb-helper.c b/drivers/gpu/drm/bridge/imx/imx-ldb-helper.c
index 61347f6ec33d906264f7e06902b0d915d263f3f8..6149ba141a389a04b3c347a67f13e049328c07ff 100644
--- a/drivers/gpu/drm/bridge/imx/imx-ldb-helper.c
+++ b/drivers/gpu/drm/bridge/imx/imx-ldb-helper.c
@@ -190,8 +190,7 @@ int ldb_find_next_bridge_helper(struct ldb *ldb)
}
EXPORT_SYMBOL_GPL(ldb_find_next_bridge_helper);
-void ldb_add_bridge_helper(struct ldb *ldb,
- const struct drm_bridge_funcs *bridge_funcs)
+void ldb_add_bridge_helper(struct ldb *ldb)
{
struct ldb_channel *ldb_ch;
int i;
@@ -203,7 +202,6 @@ void ldb_add_bridge_helper(struct ldb *ldb,
continue;
ldb_ch->bridge.driver_private = ldb_ch;
- ldb_ch->bridge.funcs = bridge_funcs;
ldb_ch->bridge.of_node = ldb_ch->np;
drm_bridge_add(&ldb_ch->bridge);
diff --git a/drivers/gpu/drm/bridge/imx/imx-ldb-helper.h b/drivers/gpu/drm/bridge/imx/imx-ldb-helper.h
index 38a8a54b37a60e1be942aaa60b1d1bc375a7a131..de187e3269996d284ecad451dd857271056812e1 100644
--- a/drivers/gpu/drm/bridge/imx/imx-ldb-helper.h
+++ b/drivers/gpu/drm/bridge/imx/imx-ldb-helper.h
@@ -88,8 +88,7 @@ int ldb_init_helper(struct ldb *ldb);
int ldb_find_next_bridge_helper(struct ldb *ldb);
-void ldb_add_bridge_helper(struct ldb *ldb,
- const struct drm_bridge_funcs *bridge_funcs);
+void ldb_add_bridge_helper(struct ldb *ldb);
void ldb_remove_bridge_helper(struct ldb *ldb);
diff --git a/drivers/gpu/drm/bridge/imx/imx8qm-ldb.c b/drivers/gpu/drm/bridge/imx/imx8qm-ldb.c
index 524aac751359f5cd377807508cbeeb6a597529e1..47aa65938e6a521cd6f111535f6feb3920a0dfb7 100644
--- a/drivers/gpu/drm/bridge/imx/imx8qm-ldb.c
+++ b/drivers/gpu/drm/bridge/imx/imx8qm-ldb.c
@@ -47,7 +47,7 @@ struct imx8qm_ldb_channel {
struct imx8qm_ldb {
struct ldb base;
struct device *dev;
- struct imx8qm_ldb_channel channel[MAX_LDB_CHAN_NUM];
+ struct imx8qm_ldb_channel *channel[MAX_LDB_CHAN_NUM];
struct clk *clk_pixel;
struct clk *clk_bypass;
int active_chno;
@@ -107,7 +107,7 @@ static int imx8qm_ldb_bridge_atomic_check(struct drm_bridge *bridge,
if (is_split) {
imx8qm_ldb_ch =
- &imx8qm_ldb->channel[imx8qm_ldb->active_chno ^ 1];
+ imx8qm_ldb->channel[imx8qm_ldb->active_chno ^ 1];
imx8qm_ldb_set_phy_cfg(imx8qm_ldb, di_clk, is_split, true,
phy_cfg);
ret = phy_validate(imx8qm_ldb_ch->phy, PHY_MODE_LVDS, 0, &opts);
@@ -158,7 +158,7 @@ imx8qm_ldb_bridge_mode_set(struct drm_bridge *bridge,
if (is_split) {
imx8qm_ldb_ch =
- &imx8qm_ldb->channel[imx8qm_ldb->active_chno ^ 1];
+ imx8qm_ldb->channel[imx8qm_ldb->active_chno ^ 1];
imx8qm_ldb_set_phy_cfg(imx8qm_ldb, di_clk, is_split, true,
phy_cfg);
ret = phy_configure(imx8qm_ldb_ch->phy, &opts);
@@ -226,13 +226,13 @@ static void imx8qm_ldb_bridge_atomic_enable(struct drm_bridge *bridge,
}
if (is_split) {
- ret = phy_power_on(imx8qm_ldb->channel[0].phy);
+ ret = phy_power_on(imx8qm_ldb->channel[0]->phy);
if (ret)
DRM_DEV_ERROR(dev,
"failed to power on channel0 PHY: %d\n",
ret);
- ret = phy_power_on(imx8qm_ldb->channel[1].phy);
+ ret = phy_power_on(imx8qm_ldb->channel[1]->phy);
if (ret)
DRM_DEV_ERROR(dev,
"failed to power on channel1 PHY: %d\n",
@@ -261,12 +261,12 @@ static void imx8qm_ldb_bridge_atomic_disable(struct drm_bridge *bridge,
ldb_bridge_disable_helper(bridge);
if (is_split) {
- ret = phy_power_off(imx8qm_ldb->channel[0].phy);
+ ret = phy_power_off(imx8qm_ldb->channel[0]->phy);
if (ret)
DRM_DEV_ERROR(dev,
"failed to power off channel0 PHY: %d\n",
ret);
- ret = phy_power_off(imx8qm_ldb->channel[1].phy);
+ ret = phy_power_off(imx8qm_ldb->channel[1]->phy);
if (ret)
DRM_DEV_ERROR(dev,
"failed to power off channel1 PHY: %d\n",
@@ -412,7 +412,7 @@ static int imx8qm_ldb_get_phy(struct imx8qm_ldb *imx8qm_ldb)
int i, ret;
for (i = 0; i < MAX_LDB_CHAN_NUM; i++) {
- imx8qm_ldb_ch = &imx8qm_ldb->channel[i];
+ imx8qm_ldb_ch = imx8qm_ldb->channel[i];
ldb_ch = &imx8qm_ldb_ch->base;
if (!ldb_ch->is_available)
@@ -448,6 +448,14 @@ static int imx8qm_ldb_probe(struct platform_device *pdev)
if (!imx8qm_ldb)
return -ENOMEM;
+ for (i = 0; i < MAX_LDB_CHAN_NUM; i++) {
+ imx8qm_ldb->channel[i] =
+ devm_drm_bridge_alloc(dev, struct imx8qm_ldb_channel, base.bridge,
+ &imx8qm_ldb_bridge_funcs);
+ if (IS_ERR(imx8qm_ldb->channel[i]))
+ return PTR_ERR(imx8qm_ldb->channel[i]);
+ }
+
imx8qm_ldb->clk_pixel = devm_clk_get(dev, "pixel");
if (IS_ERR(imx8qm_ldb->clk_pixel)) {
ret = PTR_ERR(imx8qm_ldb->clk_pixel);
@@ -473,7 +481,7 @@ static int imx8qm_ldb_probe(struct platform_device *pdev)
ldb->ctrl_reg = 0xe0;
for (i = 0; i < MAX_LDB_CHAN_NUM; i++)
- ldb->channel[i] = &imx8qm_ldb->channel[i].base;
+ ldb->channel[i] = &imx8qm_ldb->channel[i]->base;
ret = ldb_init_helper(ldb);
if (ret)
@@ -499,12 +507,12 @@ static int imx8qm_ldb_probe(struct platform_device *pdev)
}
imx8qm_ldb->active_chno = 0;
- imx8qm_ldb_ch = &imx8qm_ldb->channel[0];
+ imx8qm_ldb_ch = imx8qm_ldb->channel[0];
ldb_ch = &imx8qm_ldb_ch->base;
ldb_ch->link_type = pixel_order;
} else {
for (i = 0; i < MAX_LDB_CHAN_NUM; i++) {
- imx8qm_ldb_ch = &imx8qm_ldb->channel[i];
+ imx8qm_ldb_ch = imx8qm_ldb->channel[i];
ldb_ch = &imx8qm_ldb_ch->base;
if (ldb_ch->is_available) {
@@ -525,7 +533,7 @@ static int imx8qm_ldb_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, imx8qm_ldb);
pm_runtime_enable(dev);
- ldb_add_bridge_helper(ldb, &imx8qm_ldb_bridge_funcs);
+ ldb_add_bridge_helper(ldb);
return ret;
}
diff --git a/drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c b/drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c
index d4f3492ca5abf65a3327d7fa62214832946eb218..5d272916e200980f7253a032701dcd990e0e34f2 100644
--- a/drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c
+++ b/drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c
@@ -44,7 +44,7 @@ struct imx8qxp_ldb_channel {
struct imx8qxp_ldb {
struct ldb base;
struct device *dev;
- struct imx8qxp_ldb_channel channel[MAX_LDB_CHAN_NUM];
+ struct imx8qxp_ldb_channel *channel[MAX_LDB_CHAN_NUM];
struct clk *clk_pixel;
struct clk *clk_bypass;
struct drm_bridge *companion;
@@ -410,7 +410,7 @@ static const struct drm_bridge_funcs imx8qxp_ldb_bridge_funcs = {
static int imx8qxp_ldb_set_di_id(struct imx8qxp_ldb *imx8qxp_ldb)
{
struct imx8qxp_ldb_channel *imx8qxp_ldb_ch =
- &imx8qxp_ldb->channel[imx8qxp_ldb->active_chno];
+ imx8qxp_ldb->channel[imx8qxp_ldb->active_chno];
struct ldb_channel *ldb_ch = &imx8qxp_ldb_ch->base;
struct device_node *ep, *remote;
struct device *dev = imx8qxp_ldb->dev;
@@ -456,7 +456,7 @@ imx8qxp_ldb_check_chno_and_dual_link(struct ldb_channel *ldb_ch, int link)
static int imx8qxp_ldb_parse_dt_companion(struct imx8qxp_ldb *imx8qxp_ldb)
{
struct imx8qxp_ldb_channel *imx8qxp_ldb_ch =
- &imx8qxp_ldb->channel[imx8qxp_ldb->active_chno];
+ imx8qxp_ldb->channel[imx8qxp_ldb->active_chno];
struct ldb_channel *ldb_ch = &imx8qxp_ldb_ch->base;
struct ldb_channel *companion_ldb_ch;
struct device_node *companion;
@@ -586,6 +586,14 @@ static int imx8qxp_ldb_probe(struct platform_device *pdev)
if (!imx8qxp_ldb)
return -ENOMEM;
+ for (i = 0; i < MAX_LDB_CHAN_NUM; i++) {
+ imx8qxp_ldb->channel[i] =
+ devm_drm_bridge_alloc(dev, struct imx8qxp_ldb_channel, base.bridge,
+ &imx8qxp_ldb_bridge_funcs);
+ if (IS_ERR(imx8qxp_ldb->channel[i]))
+ return PTR_ERR(imx8qxp_ldb->channel[i]);
+ }
+
imx8qxp_ldb->clk_pixel = devm_clk_get(dev, "pixel");
if (IS_ERR(imx8qxp_ldb->clk_pixel)) {
ret = PTR_ERR(imx8qxp_ldb->clk_pixel);
@@ -611,7 +619,7 @@ static int imx8qxp_ldb_probe(struct platform_device *pdev)
ldb->ctrl_reg = 0xe0;
for (i = 0; i < MAX_LDB_CHAN_NUM; i++)
- ldb->channel[i] = &imx8qxp_ldb->channel[i].base;
+ ldb->channel[i] = &imx8qxp_ldb->channel[i]->base;
ret = ldb_init_helper(ldb);
if (ret)
@@ -627,7 +635,7 @@ static int imx8qxp_ldb_probe(struct platform_device *pdev)
}
for (i = 0; i < MAX_LDB_CHAN_NUM; i++) {
- imx8qxp_ldb_ch = &imx8qxp_ldb->channel[i];
+ imx8qxp_ldb_ch = imx8qxp_ldb->channel[i];
ldb_ch = &imx8qxp_ldb_ch->base;
if (ldb_ch->is_available) {
@@ -660,7 +668,7 @@ static int imx8qxp_ldb_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, imx8qxp_ldb);
pm_runtime_enable(dev);
- ldb_add_bridge_helper(ldb, &imx8qxp_ldb_bridge_funcs);
+ ldb_add_bridge_helper(ldb);
return 0;
}
--
2.49.0
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH v2 32/34] drm/bridge: tc358767: convert to devm_drm_bridge_alloc() API
[not found] <20250424-drm-bridge-convert-to-alloc-api-v2-0-8f91a404d86b@bootlin.com>
` (29 preceding siblings ...)
2025-04-24 18:59 ` [PATCH v2 31/34] drm/bridge: imx8*-ldb: " Luca Ceresoli
@ 2025-04-24 18:59 ` Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 33/34] drm/bridge: add devm_drm_put_bridge() Luca Ceresoli
2025-04-24 20:05 ` [PATCH v2 34/34] drm/bridge: panel: convert to devm_drm_bridge_alloc() API Luca Ceresoli
32 siblings, 0 replies; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-24 18:59 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Luca Ceresoli
This is the new API for allocating DRM bridges.
Converting this driver is a bit convoluted because the drm_bridge funcs
pointer differs based on the bridge mode. So the current code does:
* tc_probe()
* devm_kzalloc() private struct embedding drm_bridge
* call tc_probe_bridge_endpoint() which
* parses DT description into struct fields
* computes the mode
* calls different bridge init functions based on the mode
* each sets a different bridge.funcs pointer
The new API expects the funcs pointer to be known at alloc time, which does
not fit in the current code structure.
Solve this by moving the part of tc_probe_bridge_endpoint() computing the
mode into a separate function, tc_probe_get_mode(), which does not need the
private driver structure. So now the mode is known before allocation and so
is the funcs pointer, while all other operations are still happening after
allocation, directly into the private struct data, as they used to.
This solution is chosen to minimize the changes in the driver logical code
flow. The drawback is we now iterate twice over the endpoints.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/bridge/tc358767.c | 56 ++++++++++++++++++++++++++++-----------
1 file changed, 40 insertions(+), 16 deletions(-)
diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c
index 7e5449fb86a3fcdae8255bc490d12c543ef3f8ae..61559467e2d22b4b1b4223c97766ca3bf58908fd 100644
--- a/drivers/gpu/drm/bridge/tc358767.c
+++ b/drivers/gpu/drm/bridge/tc358767.c
@@ -344,6 +344,14 @@
#define COLOR_BAR_MODE_BARS 2
#define PLL_DBG 0x0a04
+enum tc_mode {
+ mode_dpi_to_edp = BIT(1) | BIT(2),
+ mode_dpi_to_dp = BIT(1),
+ mode_dsi_to_edp = BIT(0) | BIT(2),
+ mode_dsi_to_dp = BIT(0),
+ mode_dsi_to_dpi = BIT(0) | BIT(1),
+};
+
static bool tc_test_pattern;
module_param_named(test, tc_test_pattern, bool, 0644);
@@ -2327,7 +2335,6 @@ static int tc_probe_dpi_bridge_endpoint(struct tc_data *tc)
if (bridge) {
tc->panel_bridge = bridge;
tc->bridge.type = DRM_MODE_CONNECTOR_DPI;
- tc->bridge.funcs = &tc_dpi_bridge_funcs;
return 0;
}
@@ -2360,7 +2367,6 @@ static int tc_probe_edp_bridge_endpoint(struct tc_data *tc)
tc->bridge.type = DRM_MODE_CONNECTOR_DisplayPort;
}
- tc->bridge.funcs = &tc_edp_bridge_funcs;
if (tc->hpd_pin >= 0)
tc->bridge.ops |= DRM_BRIDGE_OP_DETECT;
tc->bridge.ops |= DRM_BRIDGE_OP_EDID;
@@ -2368,17 +2374,11 @@ static int tc_probe_edp_bridge_endpoint(struct tc_data *tc)
return 0;
}
-static int tc_probe_bridge_endpoint(struct tc_data *tc)
+static enum tc_mode tc_probe_get_mode(struct device *dev)
{
- struct device *dev = tc->dev;
struct of_endpoint endpoint;
struct device_node *node = NULL;
- const u8 mode_dpi_to_edp = BIT(1) | BIT(2);
- const u8 mode_dpi_to_dp = BIT(1);
- const u8 mode_dsi_to_edp = BIT(0) | BIT(2);
- const u8 mode_dsi_to_dp = BIT(0);
- const u8 mode_dsi_to_dpi = BIT(0) | BIT(1);
- u8 mode = 0;
+ enum tc_mode mode = 0;
/*
* Determine bridge configuration.
@@ -2401,7 +2401,27 @@ static int tc_probe_bridge_endpoint(struct tc_data *tc)
return -EINVAL;
}
mode |= BIT(endpoint.port);
+ }
+
+ if (mode != mode_dpi_to_edp &&
+ mode != mode_dpi_to_dp &&
+ mode != mode_dsi_to_dpi &&
+ mode != mode_dsi_to_edp &&
+ mode != mode_dsi_to_dp) {
+ dev_warn(dev, "Invalid mode (0x%x) is not supported!\n", mode);
+ return -EINVAL;
+ }
+
+ return mode;
+}
+static int tc_probe_bridge_endpoint(struct tc_data *tc, enum tc_mode mode)
+{
+ struct device *dev = tc->dev;
+ struct of_endpoint endpoint;
+ struct device_node *node = NULL;
+
+ for_each_endpoint_of_node(dev->of_node, node) {
if (endpoint.port == 2) {
of_property_read_u8_array(node, "toshiba,pre-emphasis",
tc->pre_emphasis,
@@ -2427,24 +2447,28 @@ static int tc_probe_bridge_endpoint(struct tc_data *tc)
return tc_probe_edp_bridge_endpoint(tc);
}
- dev_warn(dev, "Invalid mode (0x%x) is not supported!\n", mode);
-
+ /* Should never happen, mode was validated by tc_probe_get_mode() */
return -EINVAL;
}
static int tc_probe(struct i2c_client *client)
{
struct device *dev = &client->dev;
+ const struct drm_bridge_funcs *funcs;
struct tc_data *tc;
+ int mode;
int ret;
- tc = devm_kzalloc(dev, sizeof(*tc), GFP_KERNEL);
- if (!tc)
- return -ENOMEM;
+ mode = tc_probe_get_mode(dev);
+ funcs = (mode == mode_dsi_to_dpi) ? &tc_dpi_bridge_funcs : &tc_edp_bridge_funcs;
+
+ tc = devm_drm_bridge_alloc(dev, struct tc_data, bridge, funcs);
+ if (IS_ERR(tc))
+ return PTR_ERR(tc);
tc->dev = dev;
- ret = tc_probe_bridge_endpoint(tc);
+ ret = tc_probe_bridge_endpoint(tc, mode);
if (ret)
return ret;
--
2.49.0
^ permalink raw reply related [flat|nested] 55+ messages in thread
* [PATCH v2 33/34] drm/bridge: add devm_drm_put_bridge()
[not found] <20250424-drm-bridge-convert-to-alloc-api-v2-0-8f91a404d86b@bootlin.com>
` (30 preceding siblings ...)
2025-04-24 18:59 ` [PATCH v2 32/34] drm/bridge: tc358767: " Luca Ceresoli
@ 2025-04-24 18:59 ` Luca Ceresoli
2025-04-24 20:05 ` [PATCH v2 34/34] drm/bridge: panel: convert to devm_drm_bridge_alloc() API Luca Ceresoli
32 siblings, 0 replies; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-24 18:59 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Luca Ceresoli
Bridges obtained via devm_drm_bridge_alloc(dev, ...) will be put when the
requesting device (@dev) is removed.
However drivers which obtained them may need to put the obtained reference
explicitly. One such case is if they bind the devm removal action to a
different device than the one implemented by the driver itself and which
might be removed at a different time, such as bridge/panel.c.
Add devm_drm_put_bridge() to manually release a devm-obtained bridge in
such cases.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/drm_bridge.c | 14 ++++++++++++++
include/drm/drm_bridge.h | 4 ++++
2 files changed, 18 insertions(+)
diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
index b4c89ec01998b849018ce031c7cd84614e65e710..456363d86080b2a55035c3108c16afa4f9e57e06 100644
--- a/drivers/gpu/drm/drm_bridge.c
+++ b/drivers/gpu/drm/drm_bridge.c
@@ -1392,6 +1392,20 @@ struct drm_bridge *of_drm_find_bridge(struct device_node *np)
EXPORT_SYMBOL(of_drm_find_bridge);
#endif
+/**
+ * devm_drm_put_bridge - Release a bridge reference obtained via devm
+ * @dev: device that got the bridge via devm
+ * @bridge: pointer to a struct drm_bridge obtained via devm
+ *
+ * Same as drm_bridge_put() for bridge pointers obtained via devm functions
+ * such as devm_drm_bridge_alloc().
+ */
+void devm_drm_put_bridge(struct device *dev, struct drm_bridge *bridge)
+{
+ devm_release_action(dev, drm_bridge_put_void, bridge);
+}
+EXPORT_SYMBOL(devm_drm_put_bridge);
+
static void drm_bridge_debugfs_show_bridge(struct drm_printer *p,
struct drm_bridge *bridge,
unsigned int idx)
diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
index 4e418a29a9ff9d014d6ac0910a5d9bcf7118195e..6f00a3998ed6d026332b0f1e3bb5bee3cb5158e0 100644
--- a/include/drm/drm_bridge.h
+++ b/include/drm/drm_bridge.h
@@ -1265,6 +1265,8 @@ static inline struct drm_bridge *devm_drm_of_get_bridge(struct device *dev,
return ERR_PTR(-ENODEV);
}
+static inline void devm_drm_put_bridge(struct device *dev, struct drm_bridge *bridge) {}
+
static inline struct drm_bridge *drmm_of_get_bridge(struct drm_device *drm,
struct device_node *node,
u32 port,
@@ -1274,6 +1276,8 @@ static inline struct drm_bridge *drmm_of_get_bridge(struct drm_device *drm,
}
#endif
+void devm_drm_put_bridge(struct device *dev, struct drm_bridge *bridge);
+
void drm_bridge_debugfs_params(struct dentry *root);
void drm_bridge_debugfs_encoder_params(struct dentry *root, struct drm_encoder *encoder);
--
2.49.0
^ permalink raw reply related [flat|nested] 55+ messages in thread
* Re: [PATCH v2 11/34] drm/bridge: dw-hdmi: convert to devm_drm_bridge_alloc() API
2025-04-24 18:59 ` [PATCH v2 11/34] drm/bridge: dw-hdmi: " Luca Ceresoli
@ 2025-04-24 19:16 ` Cristian Ciocaltea
0 siblings, 0 replies; 55+ messages in thread
From: Cristian Ciocaltea @ 2025-04-24 19:16 UTC (permalink / raw)
To: Luca Ceresoli, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Andrzej Hajda,
Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
Jernej Skrabec, Jagan Teki, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Douglas Anderson,
Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32
On 4/24/25 9:59 PM, Luca Ceresoli wrote:
> This is the new API for allocating DRM bridges.
>
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
>
> ---
>
> Cc: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
> ---
> drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
Reviewed-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
^ permalink raw reply [flat|nested] 55+ messages in thread
* [PATCH v2 34/34] drm/bridge: panel: convert to devm_drm_bridge_alloc() API
[not found] <20250424-drm-bridge-convert-to-alloc-api-v2-0-8f91a404d86b@bootlin.com>
` (31 preceding siblings ...)
2025-04-24 18:59 ` [PATCH v2 33/34] drm/bridge: add devm_drm_put_bridge() Luca Ceresoli
@ 2025-04-24 20:05 ` Luca Ceresoli
2025-04-28 11:39 ` Maxime Ripard
32 siblings, 1 reply; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-24 20:05 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Luca Ceresoli, Anusha Srivatsa, Paul Kocialkowski,
Dmitry Baryshkov, Hui Pu, Thomas Petazzoni, dri-devel, asahi,
linux-kernel, chrome-platform, imx, linux-arm-kernel,
linux-mediatek, linux-amlogic, linux-renesas-soc,
platform-driver-x86, linux-samsung-soc, linux-arm-msm, freedreno,
linux-stm32
This is the new API for allocating DRM bridges.
The devm lifetime management of this driver is peculiar. The underlying
device for the panel_bridge is the panel, and the devm lifetime is tied the
panel device (panel->dev). However the panel_bridge allocation is not
performed by the panel driver, but rather by a separate entity (typically
the previous bridge in the encoder chain).
Thus when that separate entoty is destroyed, the panel_bridge is not
removed automatically by devm, so it is rather done explicitly by calling
drm_panel_bridge_remove(). This is the function that does devm_kfree() the
panel_bridge in current code, so update it as well to put the bridge
reference instead.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/bridge/panel.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c
index 79b009ab9396048eac57ad47631a902e949d77c6..ddd1e91970d09b93aa64f50cd9155939a12a2c6f 100644
--- a/drivers/gpu/drm/bridge/panel.c
+++ b/drivers/gpu/drm/bridge/panel.c
@@ -287,15 +287,14 @@ struct drm_bridge *drm_panel_bridge_add_typed(struct drm_panel *panel,
if (!panel)
return ERR_PTR(-EINVAL);
- panel_bridge = devm_kzalloc(panel->dev, sizeof(*panel_bridge),
- GFP_KERNEL);
- if (!panel_bridge)
- return ERR_PTR(-ENOMEM);
+ panel_bridge = devm_drm_bridge_alloc(panel->dev, struct panel_bridge, bridge,
+ &panel_bridge_bridge_funcs);
+ if (IS_ERR(panel_bridge))
+ return (void *)panel_bridge;
panel_bridge->connector_type = connector_type;
panel_bridge->panel = panel;
- panel_bridge->bridge.funcs = &panel_bridge_bridge_funcs;
panel_bridge->bridge.of_node = panel->dev->of_node;
panel_bridge->bridge.ops = DRM_BRIDGE_OP_MODES;
panel_bridge->bridge.type = connector_type;
@@ -327,7 +326,7 @@ void drm_panel_bridge_remove(struct drm_bridge *bridge)
panel_bridge = drm_bridge_to_panel_bridge(bridge);
drm_bridge_remove(bridge);
- devm_kfree(panel_bridge->panel->dev, bridge);
+ devm_drm_put_bridge(panel_bridge->panel->dev, bridge);
}
EXPORT_SYMBOL(drm_panel_bridge_remove);
--
2.49.0
^ permalink raw reply related [flat|nested] 55+ messages in thread
* Re: [PATCH v2 34/34] drm/bridge: panel: convert to devm_drm_bridge_alloc() API
2025-04-24 20:05 ` [PATCH v2 34/34] drm/bridge: panel: convert to devm_drm_bridge_alloc() API Luca Ceresoli
@ 2025-04-28 11:39 ` Maxime Ripard
2025-04-28 15:25 ` Luca Ceresoli
0 siblings, 1 reply; 55+ messages in thread
From: Maxime Ripard @ 2025-04-28 11:39 UTC (permalink / raw)
To: Luca Ceresoli
Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Jagan Teki, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski,
Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32
[-- Attachment #1: Type: text/plain, Size: 1032 bytes --]
On Thu, Apr 24, 2025 at 10:05:49PM +0200, Luca Ceresoli wrote:
> This is the new API for allocating DRM bridges.
>
> The devm lifetime management of this driver is peculiar. The underlying
> device for the panel_bridge is the panel, and the devm lifetime is tied the
> panel device (panel->dev). However the panel_bridge allocation is not
> performed by the panel driver, but rather by a separate entity (typically
> the previous bridge in the encoder chain).
>
> Thus when that separate entoty is destroyed, the panel_bridge is not
> removed automatically by devm, so it is rather done explicitly by calling
> drm_panel_bridge_remove(). This is the function that does devm_kfree() the
> panel_bridge in current code, so update it as well to put the bridge
> reference instead.
>
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
This looks fine, but we need a TODO entry to clean this up later on, and
a comment on devm_drm_put_bridge that this is inherently unsafe and
must not be used.
Maxime
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re:[PATCH v2 03/34] drm/bridge: analogix-anx6345: convert to devm_drm_bridge_alloc() API
2025-04-24 18:59 ` [PATCH v2 03/34] drm/bridge: analogix-anx6345: " Luca Ceresoli
@ 2025-04-28 12:29 ` Andy Yan
0 siblings, 0 replies; 55+ messages in thread
From: Andy Yan @ 2025-04-28 12:29 UTC (permalink / raw)
To: Luca Ceresoli
Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski,
Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Uwe Kleine-König,
Andy Yan, Dmitry Baryshkov, Jani Nikula, Sui Jingfeng
Hi,
At 2025-04-25 02:59:10, "Luca Ceresoli" <luca.ceresoli@bootlin.com> wrote:
>This is the new API for allocating DRM bridges.
>
>Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Reviewed-by: Andy Yan <andyshrk@163.com>
>
>---
>
>Cc: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
>Cc: Andy Yan <andy.yan@rock-chips.com>
>Cc: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
>Cc: Jani Nikula <jani.nikula@intel.com>
>Cc: Sui Jingfeng <sui.jingfeng@linux.dev>
>---
> drivers/gpu/drm/bridge/analogix/analogix-anx6345.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
>diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
>index f2bafa6cf77956ecafc87aae3a2b6890bdb36cfa..f3fe47b12edca1f92ddd306d152be144df5649b5 100644
>--- a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
>+++ b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
>@@ -664,9 +664,10 @@ static int anx6345_i2c_probe(struct i2c_client *client)
> struct device *dev;
> int i, err;
>
>- anx6345 = devm_kzalloc(&client->dev, sizeof(*anx6345), GFP_KERNEL);
>- if (!anx6345)
>- return -ENOMEM;
>+ anx6345 = devm_drm_bridge_alloc(&client->dev, struct anx6345, bridge,
>+ &anx6345_bridge_funcs);
>+ if (IS_ERR(anx6345))
>+ return PTR_ERR(anx6345);
>
> mutex_init(&anx6345->lock);
>
>@@ -738,7 +739,6 @@ static int anx6345_i2c_probe(struct i2c_client *client)
> /* Look for supported chip ID */
> anx6345_poweron(anx6345);
> if (anx6345_get_chip_id(anx6345)) {
>- anx6345->bridge.funcs = &anx6345_bridge_funcs;
> drm_bridge_add(&anx6345->bridge);
>
> return 0;
>
>--
>2.49.0
>
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH v2 34/34] drm/bridge: panel: convert to devm_drm_bridge_alloc() API
2025-04-28 11:39 ` Maxime Ripard
@ 2025-04-28 15:25 ` Luca Ceresoli
2025-05-05 6:23 ` Maxime Ripard
0 siblings, 1 reply; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-28 15:25 UTC (permalink / raw)
To: Maxime Ripard
Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Jagan Teki, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski,
Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32
Hi Maxime,
On Mon, 28 Apr 2025 13:39:23 +0200
Maxime Ripard <mripard@kernel.org> wrote:
> On Thu, Apr 24, 2025 at 10:05:49PM +0200, Luca Ceresoli wrote:
> > This is the new API for allocating DRM bridges.
> >
> > The devm lifetime management of this driver is peculiar. The underlying
> > device for the panel_bridge is the panel, and the devm lifetime is tied the
> > panel device (panel->dev). However the panel_bridge allocation is not
> > performed by the panel driver, but rather by a separate entity (typically
> > the previous bridge in the encoder chain).
> >
> > Thus when that separate entoty is destroyed, the panel_bridge is not
> > removed automatically by devm, so it is rather done explicitly by calling
> > drm_panel_bridge_remove(). This is the function that does devm_kfree() the
> > panel_bridge in current code, so update it as well to put the bridge
> > reference instead.
> >
> > Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
>
> This looks fine, but we need a TODO entry to clean this up later on, and
> a comment on devm_drm_put_bridge that this is inherently unsafe and
> must not be used.
Ah, I see, OK.
Quick draft:
/**
* devm_drm_put_bridge - Release a bridge reference obtained via devm
* @dev: device that got the bridge via devm
* @bridge: pointer to a struct drm_bridge obtained via devm
*
* Same as drm_bridge_put() for bridge pointers obtained via devm functions
* such as devm_drm_bridge_alloc().
+ *
+ * This function is a temporary workaround and MUST NOT be used. Manual
+ * handling of bridge lifetime is inherently unsafe.
*/
and:
- devm_kfree(panel_bridge->panel->dev, bridge);
+ /* TODO remove this after reworking panel_bridge lifetime */
+ devm_drm_put_bridge(panel_bridge->panel->dev, bridge);
}
Does it look good enough?
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH v2 27/34] drm/vc4: convert to devm_drm_bridge_alloc() API
2025-04-24 18:59 ` [PATCH v2 27/34] drm/vc4: " Luca Ceresoli
@ 2025-04-28 15:45 ` Dave Stevenson
0 siblings, 0 replies; 55+ messages in thread
From: Dave Stevenson @ 2025-04-28 15:45 UTC (permalink / raw)
To: Luca Ceresoli
Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski,
Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Maíra Canal,
Raspberry Pi Kernel Maintenance
On Thu, 24 Apr 2025 at 20:01, Luca Ceresoli <luca.ceresoli@bootlin.com> wrote:
>
> This is the new API for allocating DRM bridges.
>
> This driver already implements refcounting of the struct vc4_dsi, which
> embeds struct drm_bridge. Now this is a duplicate of the refcounting
> implemented by the DRM bridge core, so convert the vc4_dsi_get/put() calls
> into drm_bridge_get/put() calls and get rid of the driver-specific
> refcounting implementation.
>
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Acked-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Thanks.
> ---
>
> Cc: "Maíra Canal" <mcanal@igalia.com>
> Cc: Dave Stevenson <dave.stevenson@raspberrypi.com>
> Cc: Raspberry Pi Kernel Maintenance <kernel-list@raspberrypi.com>
>
> Changed in v2:
> - fix error code checking
> ---
> drivers/gpu/drm/vc4/vc4_dsi.c | 34 +++++-----------------------------
> 1 file changed, 5 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c
> index efc6f6078b026764c59cfb2a33b28a88b7018c3a..458e5d9879645f18bcbcaeeb71b5f1038f9581da 100644
> --- a/drivers/gpu/drm/vc4/vc4_dsi.c
> +++ b/drivers/gpu/drm/vc4/vc4_dsi.c
> @@ -552,8 +552,6 @@ struct vc4_dsi {
> struct vc4_encoder encoder;
> struct mipi_dsi_host dsi_host;
>
> - struct kref kref;
> -
> struct platform_device *pdev;
>
> struct drm_bridge *out_bridge;
> @@ -1622,29 +1620,11 @@ static void vc4_dsi_dma_chan_release(void *ptr)
> dsi->reg_dma_chan = NULL;
> }
>
> -static void vc4_dsi_release(struct kref *kref)
> -{
> - struct vc4_dsi *dsi =
> - container_of(kref, struct vc4_dsi, kref);
> -
> - kfree(dsi);
> -}
> -
> -static void vc4_dsi_get(struct vc4_dsi *dsi)
> -{
> - kref_get(&dsi->kref);
> -}
> -
> -static void vc4_dsi_put(struct vc4_dsi *dsi)
> -{
> - kref_put(&dsi->kref, &vc4_dsi_release);
> -}
> -
> static void vc4_dsi_release_action(struct drm_device *drm, void *ptr)
> {
> struct vc4_dsi *dsi = ptr;
>
> - vc4_dsi_put(dsi);
> + drm_bridge_put(&dsi->bridge);
> }
>
> static int vc4_dsi_bind(struct device *dev, struct device *master, void *data)
> @@ -1655,7 +1635,7 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data)
> struct drm_encoder *encoder = &dsi->encoder.base;
> int ret;
>
> - vc4_dsi_get(dsi);
> + drm_bridge_get(&dsi->bridge);
>
> ret = drmm_add_action_or_reset(drm, vc4_dsi_release_action, dsi);
> if (ret)
> @@ -1810,15 +1790,12 @@ static int vc4_dsi_dev_probe(struct platform_device *pdev)
> struct device *dev = &pdev->dev;
> struct vc4_dsi *dsi;
>
> - dsi = kzalloc(sizeof(*dsi), GFP_KERNEL);
> - if (!dsi)
> - return -ENOMEM;
> + dsi = devm_drm_bridge_alloc(&pdev->dev, struct vc4_dsi, bridge, &vc4_dsi_bridge_funcs);
> + if (IS_ERR(dsi))
> + return PTR_ERR(dsi);
> dev_set_drvdata(dev, dsi);
>
> - kref_init(&dsi->kref);
> -
> dsi->pdev = pdev;
> - dsi->bridge.funcs = &vc4_dsi_bridge_funcs;
> #ifdef CONFIG_OF
> dsi->bridge.of_node = dev->of_node;
> #endif
> @@ -1836,7 +1813,6 @@ static void vc4_dsi_dev_remove(struct platform_device *pdev)
> struct vc4_dsi *dsi = dev_get_drvdata(dev);
>
> mipi_dsi_host_unregister(&dsi->dsi_host);
> - vc4_dsi_put(dsi);
> }
>
> struct platform_driver vc4_dsi_driver = {
>
> --
> 2.49.0
>
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH v2 13/34] drm/bridge: ti-sn65dsi86: convert to devm_drm_bridge_alloc() API
2025-04-24 18:59 ` [PATCH v2 13/34] drm/bridge: ti-sn65dsi86: " Luca Ceresoli
@ 2025-04-28 20:53 ` Doug Anderson
0 siblings, 0 replies; 55+ messages in thread
From: Doug Anderson @ 2025-04-28 20:53 UTC (permalink / raw)
To: Luca Ceresoli
Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Chun-Kuang Hu, Krzysztof Kozlowski, Anusha Srivatsa,
Paul Kocialkowski, Dmitry Baryshkov, Hui Pu, Thomas Petazzoni,
dri-devel, asahi, linux-kernel, chrome-platform, imx,
linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32, Herve Codina
Hi,
On Thu, Apr 24, 2025 at 12:00 PM Luca Ceresoli
<luca.ceresoli@bootlin.com> wrote:
>
> This is the new API for allocating DRM bridges.
>
> Reviewed-by: Herve Codina <herve.codina@bootlin.com>
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> ---
> drivers/gpu/drm/bridge/ti-sn65dsi86.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
Reviewed-by: Douglas Anderson <dianders@chromium.org>
I can confirm that I can still build/boot on a board with ti-sn65dsi86
after this patch. Thus, happy with:
Tested-by: Douglas Anderson <dianders@chromium.org>
Happy to have someone else land this through drm-misc-next or I can
land it there myself.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH v2 30/34] drm/bridge: imx8qxp-pixel-combiner: convert to devm_drm_bridge_alloc() API
2025-04-24 18:59 ` [PATCH v2 30/34] drm/bridge: imx8qxp-pixel-combiner: " Luca Ceresoli
@ 2025-04-29 2:10 ` Liu Ying
2025-04-30 9:29 ` Luca Ceresoli
0 siblings, 1 reply; 55+ messages in thread
From: Liu Ying @ 2025-04-29 2:10 UTC (permalink / raw)
To: Luca Ceresoli, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Andrzej Hajda,
Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
Jernej Skrabec, Jagan Teki, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Douglas Anderson,
Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32
Hi,
On 04/25/2025, Luca Ceresoli wrote:
> This is the new API for allocating DRM bridges.
>
> This driver embeds an array of channels in the main struct, and each
> channel embeds a drm_bridge. This prevents dynamic, refcount-based
> deallocation of the bridges.
>
> To make the new, dynamic bridge allocation possible:
>
> * change the array of channels into an array of channel pointers
> * allocate each channel using devm_drm_bridge_alloc()
> * adapt the code wherever using the channels
>
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
>
> ---
>
> Cc: Liu Ying <victor.liu@nxp.com>
> ---
> drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c | 18 ++++++++++++------
> 1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c b/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c
> index 1f6fd488e7039e943351006d3373009f0c15cb08..40a8a5a53a781137e722309ff91692cf90d881da 100644
> --- a/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c
> +++ b/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c
> @@ -68,7 +68,7 @@ struct imx8qxp_pc_channel {
>
> struct imx8qxp_pc {
> struct device *dev;
> - struct imx8qxp_pc_channel ch[2];
> + struct imx8qxp_pc_channel *ch[2];
> struct clk *clk_apb;
> void __iomem *base;
> };
> @@ -307,7 +307,14 @@ static int imx8qxp_pc_bridge_probe(struct platform_device *pdev)
> goto free_child;
> }
>
> - ch = &pc->ch[i];
> + ch = devm_drm_bridge_alloc(dev, struct imx8qxp_pc_channel, bridge,
> + &imx8qxp_pc_bridge_funcs);
> + if (IS_ERR(ch)) {
> + ret = PTR_ERR(ch);
> + goto free_child;
> + }
> +
> + pc->ch[i] = ch;
> ch->pc = pc;
> ch->stream_id = i;
>
> @@ -333,7 +340,6 @@ static int imx8qxp_pc_bridge_probe(struct platform_device *pdev)
> of_node_put(remote);
>
> ch->bridge.driver_private = ch;
> - ch->bridge.funcs = &imx8qxp_pc_bridge_funcs;
> ch->bridge.of_node = child;
> ch->is_available = true;
>
> @@ -345,8 +351,8 @@ static int imx8qxp_pc_bridge_probe(struct platform_device *pdev)
> free_child:
> of_node_put(child);
>
> - if (i == 1 && pc->ch[0].next_bridge)
> - drm_bridge_remove(&pc->ch[0].bridge);
> + if (i == 1 && pc->ch[0]->next_bridge)
Since this patch makes pc->ch[0] and pc->ch[1] be allocated separately,
pc->ch[0] could be NULL if channel0 is not available, hence a NULL pointer
dereference here...
> + drm_bridge_remove(&pc->ch[0]->bridge);
>
> pm_runtime_disable(dev);
> return ret;
> @@ -359,7 +365,7 @@ static void imx8qxp_pc_bridge_remove(struct platform_device *pdev)
> int i;
>
> for (i = 0; i < 2; i++) {
> - ch = &pc->ch[i];
> + ch = pc->ch[i];
>
> if (!ch->is_available)
...and here too.
This is what I get when removing the imx8qxp_pixel_combiner module.
-8<-
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000144
Mem abort info:
ESR = 0x0000000096000004
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
FSC = 0x04: level 0 translation fault
Data abort info:
ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
CM = 0, WnR = 0, TnD = 0, TagAccess = 0
GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
user pgtable: 4k pages, 48-bit VAs, pgdp=000000089e613000
[0000000000000144] pgd=0000000000000000, p4d=0000000000000000
Internal error: Oops: 0000000096000004 [#1] SMP
Modules linked in: mpl3115 isl29018 industrialio_triggered_buffer kfifo_buf cdns3 cdns_usb_common snd_soc_imx_audmix rtc_imx_sc imx_sc_wdt imx_sc_thermal imx_sc_key imx8qxp_pixel_link6
CPU: 1 UID: 0 PID: 528 Comm: modprobe Not tainted 6.15.0-rc3-next-20250424-00059-gee51752c256e #217 PREEMPT
Hardware name: Freescale i.MX8QXP MEK (DT)
pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : imx8qxp_pc_bridge_remove+0x38/0x6c [imx8qxp_pixel_combiner]
lr : imx8qxp_pc_bridge_remove+0x30/0x6c [imx8qxp_pixel_combiner]
sp : ffff8000840f3c40
x29: ffff8000840f3c40 x28: ffff00081e75d780 x27: 0000000000000000
x26: 0000000000000000 x25: 0000000000000000 x24: 0000000000000000
x23: ffff0008100fc090 x22: ffff0008100fe490 x21: ffff00081e69de00
x20: 0000000000000000 x19: ffff0008100fe410 x18: 0000000000000000
x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000
x14: 0000000000000013 x13: ffff000810049010 x12: 0000000000000000
x11: ffff0008182bc550 x10: ffff0008182bc490 x9 : ffff000810049010
x8 : 0101010101010101 x7 : 7f7f7f7f7f7f7f7f x6 : fefefeff6364626d
x5 : 8080808000000000 x4 : 0000000000000000 x3 : 0000000000000000
x2 : ffff00081e75d780 x1 : ffff00081e75d780 x0 : ffff80007af9bdc0
Call trace:
imx8qxp_pc_bridge_remove+0x38/0x6c [imx8qxp_pixel_combiner] (P)
platform_remove+0x28/0x44
device_remove+0x4c/0x80
device_release_driver_internal+0x1c8/0x224
driver_detach+0x50/0x98
bus_remove_driver+0x6c/0xbc
driver_unregister+0x30/0x60
platform_driver_unregister+0x14/0x20
imx8qxp_pc_bridge_driver_exit+0x18/0x814 [imx8qxp_pixel_combiner]
__arm64_sys_delete_module+0x184/0x264
invoke_syscall+0x48/0x110
el0_svc_common.constprop.0+0xc8/0xe8
do_el0_svc+0x20/0x2c
el0_svc+0x30/0xd0
el0t_64_sync_handler+0x144/0x168
el0t_64_sync+0x198/0x19c
Code: aa1503e0 97f547f8 390512bf f9400a94 (39451280)
---[ end trace 0000000000000000 ]---
-8<-
On top of this patch series, this issue doesn't happen if I apply the below
change:
diff --git a/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c b/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c
index 40a8a5a53a78..2eb0ade65d89 100644
--- a/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c
+++ b/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c
@@ -63,7 +63,6 @@ struct imx8qxp_pc_channel {
struct drm_bridge *next_bridge;
struct imx8qxp_pc *pc;
unsigned int stream_id;
- bool is_available;
};
struct imx8qxp_pc {
@@ -341,7 +340,6 @@ static int imx8qxp_pc_bridge_probe(struct platform_device *pdev)
ch->bridge.driver_private = ch;
ch->bridge.of_node = child;
- ch->is_available = true;
drm_bridge_add(&ch->bridge);
}
@@ -351,7 +349,7 @@ static int imx8qxp_pc_bridge_probe(struct platform_device *pdev)
free_child:
of_node_put(child);
- if (i == 1 && pc->ch[0]->next_bridge)
+ if (i == 1 && pc->ch[0])
drm_bridge_remove(&pc->ch[0]->bridge);
pm_runtime_disable(dev);
@@ -367,11 +365,8 @@ static void imx8qxp_pc_bridge_remove(struct platform_device *pdev)
for (i = 0; i < 2; i++) {
ch = pc->ch[i];
- if (!ch->is_available)
- continue;
-
- drm_bridge_remove(&ch->bridge);
- ch->is_available = false;
+ if (ch)
+ drm_bridge_remove(&ch->bridge);
}
pm_runtime_disable(&pdev->dev);
> continue;
>
--
Regards,
Liu Ying
^ permalink raw reply related [flat|nested] 55+ messages in thread
* Re: [PATCH v2 31/34] drm/bridge: imx8*-ldb: convert to devm_drm_bridge_alloc() API
2025-04-24 18:59 ` [PATCH v2 31/34] drm/bridge: imx8*-ldb: " Luca Ceresoli
@ 2025-04-29 2:35 ` Liu Ying
0 siblings, 0 replies; 55+ messages in thread
From: Liu Ying @ 2025-04-29 2:35 UTC (permalink / raw)
To: Luca Ceresoli, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Andrzej Hajda,
Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
Jernej Skrabec, Jagan Teki, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Douglas Anderson,
Chun-Kuang Hu, Krzysztof Kozlowski
Cc: Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32
On 04/25/2025, Luca Ceresoli wrote:
> This is the new API for allocating DRM bridges.
>
> These two drivers are tangled together by the ldb_add_bridge_helper(), so
> they are converted at once.
>
> They also have a similar design, each embedding an array of channels in
> their main struct, and each channel embeds a drm_bridge. This prevents
> dynamic, refcount-based deallocation of the bridges.
>
> To make the new, dynamic bridge allocation possible:
>
> * change the array of channels into an array of channel pointers
> * allocate each channel using devm_drm_bridge_alloc()
> * adapt ldb_add_bridge_helper() to not set the funcs pointer
> (now done by devm_drm_bridge_alloc())
> * adapt the code wherever using the channels
>
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
>
> ---
>
> Cc: Liu Ying <victor.liu@nxp.com>
> ---
> drivers/gpu/drm/bridge/imx/imx-ldb-helper.c | 4 +---
> drivers/gpu/drm/bridge/imx/imx-ldb-helper.h | 3 +--
> drivers/gpu/drm/bridge/imx/imx8qm-ldb.c | 32 ++++++++++++++++++-----------
> drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c | 20 ++++++++++++------
> 4 files changed, 36 insertions(+), 23 deletions(-)
Acked-by: Liu Ying <victor.liu@nxp.com>
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH v2 15/34] drm/mcde: convert to devm_drm_bridge_alloc() API
2025-04-24 18:59 ` [PATCH v2 15/34] drm/mcde: " Luca Ceresoli
@ 2025-04-29 8:40 ` Linus Walleij
0 siblings, 0 replies; 55+ messages in thread
From: Linus Walleij @ 2025-04-29 8:40 UTC (permalink / raw)
To: Luca Ceresoli
Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski,
Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32
On Thu, Apr 24, 2025 at 9:00 PM Luca Ceresoli <luca.ceresoli@bootlin.com> wrote:
> This is the new API for allocating DRM bridges.
>
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH v2 07/34] drm/bridge: lt9611uxc: convert to devm_drm_bridge_alloc() API
2025-04-24 18:59 ` [PATCH v2 07/34] drm/bridge: lt9611uxc: " Luca Ceresoli
@ 2025-04-29 12:09 ` Dmitry Baryshkov
0 siblings, 0 replies; 55+ messages in thread
From: Dmitry Baryshkov @ 2025-04-29 12:09 UTC (permalink / raw)
To: Luca Ceresoli
Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski,
Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32
On Thu, Apr 24, 2025 at 08:59:14PM +0200, Luca Ceresoli wrote:
> This is the new API for allocating DRM bridges.
>
> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> ---
> drivers/gpu/drm/bridge/lontium-lt9611uxc.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH v2 30/34] drm/bridge: imx8qxp-pixel-combiner: convert to devm_drm_bridge_alloc() API
2025-04-29 2:10 ` Liu Ying
@ 2025-04-30 9:29 ` Luca Ceresoli
2025-05-06 2:24 ` Liu Ying
0 siblings, 1 reply; 55+ messages in thread
From: Luca Ceresoli @ 2025-04-30 9:29 UTC (permalink / raw)
To: Liu Ying
Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski,
Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32
Hello Liu,
On Tue, 29 Apr 2025 10:10:55 +0800
Liu Ying <victor.liu@nxp.com> wrote:
> Hi,
>
> On 04/25/2025, Luca Ceresoli wrote:
> > This is the new API for allocating DRM bridges.
> >
> > This driver embeds an array of channels in the main struct, and each
> > channel embeds a drm_bridge. This prevents dynamic, refcount-based
> > deallocation of the bridges.
> >
> > To make the new, dynamic bridge allocation possible:
> >
> > * change the array of channels into an array of channel pointers
> > * allocate each channel using devm_drm_bridge_alloc()
> > * adapt the code wherever using the channels
> >
> > Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
[...]
> > @@ -345,8 +351,8 @@ static int imx8qxp_pc_bridge_probe(struct platform_device *pdev)
> > free_child:
> > of_node_put(child);
> >
> > - if (i == 1 && pc->ch[0].next_bridge)
> > - drm_bridge_remove(&pc->ch[0].bridge);
> > + if (i == 1 && pc->ch[0]->next_bridge)
>
> Since this patch makes pc->ch[0] and pc->ch[1] be allocated separately,
> pc->ch[0] could be NULL if channel0 is not available, hence a NULL pointer
> dereference here...
See below for this.
> > + drm_bridge_remove(&pc->ch[0]->bridge);
> >
> > pm_runtime_disable(dev);
> > return ret;
> > @@ -359,7 +365,7 @@ static void imx8qxp_pc_bridge_remove(struct platform_device *pdev)
> > int i;
> >
> > for (i = 0; i < 2; i++) {
> > - ch = &pc->ch[i];
> > + ch = pc->ch[i];
> >
> > if (!ch->is_available)
>
> ...and here too.
This is indeed a bug, I should have checked the pointer for being
non-NULL.
Looking at that more closely, I think the is_available flag can be
entirely removed now. The allocation itself (ch != NULL) now is
equivalent. Do you think my reasoning is correct?
Ouch! After writing the previous paragraph I realized you proposed this
a few lines below! OK, removing is_available. :)
[...]
> On top of this patch series, this issue doesn't happen if I apply the below
> change:
[...]
> @@ -351,7 +349,7 @@ static int imx8qxp_pc_bridge_probe(struct platform_device *pdev)
> free_child:
> of_node_put(child);
>
> - if (i == 1 && pc->ch[0]->next_bridge)
> + if (i == 1 && pc->ch[0])
> drm_bridge_remove(&pc->ch[0]->bridge);
Unrelated to this patch, but as I looked at it more in depth now, I'm
not sure this whole logic is robust, even in the original code.
The 'i == 1' check here seems to mean "if some error happened when
handling channel@1, that means channel@0 was successfully initialized,
so let's clean up channel 0".
However my understanding of the bindings is that device tree is allowed
to have the channel@1 node before the channel@0 node (or even channel@1
without channel@0, but that's less problematic here).
In such case (channel@1 before channel@0), this would happen:
1. alloc and init ch[1], all OK
2. alloc and init ch[0], an error happens
(e.g. of_graph_get_remote_node() fails)
So we'd reach the free_child: label, and we should call
drm_bridge_remove() for ch[1]->bridge, but there's no code to do that.
To be robust in such a case, I think both channels need to be checked
independently, as the status of one does not imply the status of the
other. E.g.:
for (i = 0; i < 2; i++)
if (pc->ch[i] && pc->ch[i]->next_bridge)
drm_bridge_remove(&pc->ch[i]->bridge);
(which is similar to what .remove() does after the changes discussed in
this thread, and which I have queued for v3)
What's your opinion? Do you think I missed anything?
Thanks for taking the time to dig into this!
Best regards,
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH v2 34/34] drm/bridge: panel: convert to devm_drm_bridge_alloc() API
2025-04-28 15:25 ` Luca Ceresoli
@ 2025-05-05 6:23 ` Maxime Ripard
2025-05-05 15:20 ` Luca Ceresoli
0 siblings, 1 reply; 55+ messages in thread
From: Maxime Ripard @ 2025-05-05 6:23 UTC (permalink / raw)
To: Luca Ceresoli
Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Jagan Teki, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski,
Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32
[-- Attachment #1: Type: text/plain, Size: 2169 bytes --]
On Mon, Apr 28, 2025 at 05:25:16PM +0200, Luca Ceresoli wrote:
> Hi Maxime,
>
> On Mon, 28 Apr 2025 13:39:23 +0200
> Maxime Ripard <mripard@kernel.org> wrote:
>
> > On Thu, Apr 24, 2025 at 10:05:49PM +0200, Luca Ceresoli wrote:
> > > This is the new API for allocating DRM bridges.
> > >
> > > The devm lifetime management of this driver is peculiar. The underlying
> > > device for the panel_bridge is the panel, and the devm lifetime is tied the
> > > panel device (panel->dev). However the panel_bridge allocation is not
> > > performed by the panel driver, but rather by a separate entity (typically
> > > the previous bridge in the encoder chain).
> > >
> > > Thus when that separate entoty is destroyed, the panel_bridge is not
> > > removed automatically by devm, so it is rather done explicitly by calling
> > > drm_panel_bridge_remove(). This is the function that does devm_kfree() the
> > > panel_bridge in current code, so update it as well to put the bridge
> > > reference instead.
> > >
> > > Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> >
> > This looks fine, but we need a TODO entry to clean this up later on, and
> > a comment on devm_drm_put_bridge that this is inherently unsafe and
> > must not be used.
>
> Ah, I see, OK.
>
> Quick draft:
>
> /**
> * devm_drm_put_bridge - Release a bridge reference obtained via devm
> * @dev: device that got the bridge via devm
> * @bridge: pointer to a struct drm_bridge obtained via devm
> *
> * Same as drm_bridge_put() for bridge pointers obtained via devm functions
> * such as devm_drm_bridge_alloc().
> + *
> + * This function is a temporary workaround and MUST NOT be used. Manual
> + * handling of bridge lifetime is inherently unsafe.
> */
That part looks good to me
> and:
>
> - devm_kfree(panel_bridge->panel->dev, bridge);
> + /* TODO remove this after reworking panel_bridge lifetime */
> + devm_drm_put_bridge(panel_bridge->panel->dev, bridge);
> }
>
> Does it look good enough?
That too, but I was talking about an entry in
https://www.kernel.org/doc/html/latest/gpu/todo.html
Maxime
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH v2 34/34] drm/bridge: panel: convert to devm_drm_bridge_alloc() API
2025-05-05 6:23 ` Maxime Ripard
@ 2025-05-05 15:20 ` Luca Ceresoli
0 siblings, 0 replies; 55+ messages in thread
From: Luca Ceresoli @ 2025-05-05 15:20 UTC (permalink / raw)
To: Maxime Ripard
Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Jagan Teki, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski,
Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32
On Mon, 5 May 2025 08:23:26 +0200
Maxime Ripard <mripard@kernel.org> wrote:
> On Mon, Apr 28, 2025 at 05:25:16PM +0200, Luca Ceresoli wrote:
> > Hi Maxime,
> >
> > On Mon, 28 Apr 2025 13:39:23 +0200
> > Maxime Ripard <mripard@kernel.org> wrote:
> >
> > > On Thu, Apr 24, 2025 at 10:05:49PM +0200, Luca Ceresoli wrote:
> > > > This is the new API for allocating DRM bridges.
> > > >
> > > > The devm lifetime management of this driver is peculiar. The underlying
> > > > device for the panel_bridge is the panel, and the devm lifetime is tied the
> > > > panel device (panel->dev). However the panel_bridge allocation is not
> > > > performed by the panel driver, but rather by a separate entity (typically
> > > > the previous bridge in the encoder chain).
> > > >
> > > > Thus when that separate entoty is destroyed, the panel_bridge is not
> > > > removed automatically by devm, so it is rather done explicitly by calling
> > > > drm_panel_bridge_remove(). This is the function that does devm_kfree() the
> > > > panel_bridge in current code, so update it as well to put the bridge
> > > > reference instead.
> > > >
> > > > Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> > >
> > > This looks fine, but we need a TODO entry to clean this up later on, and
> > > a comment on devm_drm_put_bridge that this is inherently unsafe and
> > > must not be used.
> >
> > Ah, I see, OK.
> >
> > Quick draft:
> >
> > /**
> > * devm_drm_put_bridge - Release a bridge reference obtained via devm
> > * @dev: device that got the bridge via devm
> > * @bridge: pointer to a struct drm_bridge obtained via devm
> > *
> > * Same as drm_bridge_put() for bridge pointers obtained via devm functions
> > * such as devm_drm_bridge_alloc().
> > + *
> > + * This function is a temporary workaround and MUST NOT be used. Manual
> > + * handling of bridge lifetime is inherently unsafe.
> > */
>
> That part looks good to me
>
> > and:
> >
> > - devm_kfree(panel_bridge->panel->dev, bridge);
> > + /* TODO remove this after reworking panel_bridge lifetime */
> > + devm_drm_put_bridge(panel_bridge->panel->dev, bridge);
> > }
> >
> > Does it look good enough?
>
> That too, but I was talking about an entry in
> https://www.kernel.org/doc/html/latest/gpu/todo.html
Ah, sure!
I queued this for v3, if you have better suggestions don't hesitate to
let me know:
-----8<-----
Remove devm_drm_put_bridge()
----------------------------
Due to how the panel bridge handles the drm_bridge object lifetime, special
care must be taken to dispose of the drm_bridge object when the
panel_bridge is removed. This is currently managed using
devm_drm_put_bridge(), but that is an unsafe, temporary workaround. To fix
that, the DRM panel lifetime needs to be reworked. After the rework is
done, remove devm_drm_put_bridge() and the TODO in drm_panel_bridge_remove().
Contact: Maxime Ripard <mripard@kernel.org>,
Luca Ceresoli <luca.ceresoli@bootlin.com>
Level: Intermediate
-----8<-----
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH v2 30/34] drm/bridge: imx8qxp-pixel-combiner: convert to devm_drm_bridge_alloc() API
2025-04-30 9:29 ` Luca Ceresoli
@ 2025-05-06 2:24 ` Liu Ying
2025-05-06 20:47 ` Luca Ceresoli
0 siblings, 1 reply; 55+ messages in thread
From: Liu Ying @ 2025-05-06 2:24 UTC (permalink / raw)
To: Luca Ceresoli
Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski,
Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32
On 04/30/2025, Luca Ceresoli wrote:
> Hello Liu,
Hi Luca,
>
> On Tue, 29 Apr 2025 10:10:55 +0800
> Liu Ying <victor.liu@nxp.com> wrote:
>
>> Hi,
>>
>> On 04/25/2025, Luca Ceresoli wrote:
>>> This is the new API for allocating DRM bridges.
>>>
>>> This driver embeds an array of channels in the main struct, and each
>>> channel embeds a drm_bridge. This prevents dynamic, refcount-based
>>> deallocation of the bridges.
>>>
>>> To make the new, dynamic bridge allocation possible:
>>>
>>> * change the array of channels into an array of channel pointers
>>> * allocate each channel using devm_drm_bridge_alloc()
>>> * adapt the code wherever using the channels
>>>
>>> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
>
> [...]
>
>>> @@ -345,8 +351,8 @@ static int imx8qxp_pc_bridge_probe(struct platform_device *pdev)
>>> free_child:
>>> of_node_put(child);
>>>
>>> - if (i == 1 && pc->ch[0].next_bridge)
>>> - drm_bridge_remove(&pc->ch[0].bridge);
>>> + if (i == 1 && pc->ch[0]->next_bridge)
>>
>> Since this patch makes pc->ch[0] and pc->ch[1] be allocated separately,
>> pc->ch[0] could be NULL if channel0 is not available, hence a NULL pointer
>> dereference here...
>
> See below for this.
>
>>> + drm_bridge_remove(&pc->ch[0]->bridge);
>>>
>>> pm_runtime_disable(dev);
>>> return ret;
>>> @@ -359,7 +365,7 @@ static void imx8qxp_pc_bridge_remove(struct platform_device *pdev)
>>> int i;
>>>
>>> for (i = 0; i < 2; i++) {
>>> - ch = &pc->ch[i];
>>> + ch = pc->ch[i];
>>>
>>> if (!ch->is_available)
>>
>> ...and here too.
>
> This is indeed a bug, I should have checked the pointer for being
> non-NULL.
>
> Looking at that more closely, I think the is_available flag can be
> entirely removed now. The allocation itself (ch != NULL) now is
> equivalent. Do you think my reasoning is correct?
>
> Ouch! After writing the previous paragraph I realized you proposed this
> a few lines below! OK, removing is_available. :)
>
> [...]
>
>> On top of this patch series, this issue doesn't happen if I apply the below
>> change:
>
> [...]
>
>> @@ -351,7 +349,7 @@ static int imx8qxp_pc_bridge_probe(struct platform_device *pdev)
>> free_child:
>> of_node_put(child);
>>
>> - if (i == 1 && pc->ch[0]->next_bridge)
>> + if (i == 1 && pc->ch[0])
>> drm_bridge_remove(&pc->ch[0]->bridge);
>
> Unrelated to this patch, but as I looked at it more in depth now, I'm
> not sure this whole logic is robust, even in the original code.
>
> The 'i == 1' check here seems to mean "if some error happened when
> handling channel@1, that means channel@0 was successfully initialized,
> so let's clean up channel 0".
>
> However my understanding of the bindings is that device tree is allowed
> to have the channel@1 node before the channel@0 node (or even channel@1
> without channel@0, but that's less problematic here).
>
> In such case (channel@1 before channel@0), this would happen:
>
> 1. alloc and init ch[1], all OK
> 2. alloc and init ch[0], an error happens
> (e.g. of_graph_get_remote_node() fails)
>
> So we'd reach the free_child: label, and we should call
> drm_bridge_remove() for ch[1]->bridge, but there's no code to do that.
>
> To be robust in such a case, I think both channels need to be checked
> independently, as the status of one does not imply the status of the
> other. E.g.:
>
> for (i = 0; i < 2; i++)
> if (pc->ch[i] && pc->ch[i]->next_bridge)
> drm_bridge_remove(&pc->ch[i]->bridge);
>
> (which is similar to what .remove() does after the changes discussed in
> this thread, and which I have queued for v3)
>
> What's your opinion? Do you think I missed anything?
The pixel combiner DT node would be added in imx8-ss-dc{0,1}.dtsi, please
see the case for imx8-ss-dc0.dtsi introduced by an in-flight patch[1]. As
channel@{0,1} child nodes always exist(DT overlay cannot effectively delete
any of them) and channel@0 always comes first, there is no problematic case.
>
> Thanks for taking the time to dig into this!
After looking into this patch and patch 31(though I've already provided my A-b)
more closely, I think the imx8qxp_pc and imx8{qm,qxp}_ldb main structures
should have the same life time with the embedded DRM bridges, because for
example the clk_apb clock in struct imx8qxp_pc would be accessed by the
imx8qxp_pc_bridge_mode_set DRM bridge callback. But, IIUC, your patches extend
the life time for the embedded channel/bridge structures only, but not for the
main structures. What do you think ?
>
> Best regards,
> Luca
>
[1] https://lore.kernel.org/dri-devel/20250414035028.1561475-17-victor.liu@nxp.com/
--
Regards,
Liu Ying
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH v2 30/34] drm/bridge: imx8qxp-pixel-combiner: convert to devm_drm_bridge_alloc() API
2025-05-06 2:24 ` Liu Ying
@ 2025-05-06 20:47 ` Luca Ceresoli
2025-05-07 2:10 ` Liu Ying
2025-05-22 3:01 ` Liu Ying
0 siblings, 2 replies; 55+ messages in thread
From: Luca Ceresoli @ 2025-05-06 20:47 UTC (permalink / raw)
To: Liu Ying
Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski,
Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32
Hello Liu,
thanks for your further feedback.
On Tue, 6 May 2025 10:24:18 +0800
Liu Ying <victor.liu@nxp.com> wrote:
> On 04/30/2025, Luca Ceresoli wrote:
> > Hello Liu,
>
> Hi Luca,
>
> >
> > On Tue, 29 Apr 2025 10:10:55 +0800
> > Liu Ying <victor.liu@nxp.com> wrote:
> >
> >> Hi,
> >>
> >> On 04/25/2025, Luca Ceresoli wrote:
> >>> This is the new API for allocating DRM bridges.
> >>>
> >>> This driver embeds an array of channels in the main struct, and each
> >>> channel embeds a drm_bridge. This prevents dynamic, refcount-based
> >>> deallocation of the bridges.
> >>>
> >>> To make the new, dynamic bridge allocation possible:
> >>>
> >>> * change the array of channels into an array of channel pointers
> >>> * allocate each channel using devm_drm_bridge_alloc()
> >>> * adapt the code wherever using the channels
> >>>
> >>> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> >
> > [...]
> >
> >>> @@ -345,8 +351,8 @@ static int imx8qxp_pc_bridge_probe(struct platform_device *pdev)
> >>> free_child:
> >>> of_node_put(child);
> >>>
> >>> - if (i == 1 && pc->ch[0].next_bridge)
> >>> - drm_bridge_remove(&pc->ch[0].bridge);
> >>> + if (i == 1 && pc->ch[0]->next_bridge)
> >>
> >> Since this patch makes pc->ch[0] and pc->ch[1] be allocated separately,
> >> pc->ch[0] could be NULL if channel0 is not available, hence a NULL pointer
> >> dereference here...
> >
> > See below for this.
> >
> >>> + drm_bridge_remove(&pc->ch[0]->bridge);
> >>>
> >>> pm_runtime_disable(dev);
> >>> return ret;
> >>> @@ -359,7 +365,7 @@ static void imx8qxp_pc_bridge_remove(struct platform_device *pdev)
> >>> int i;
> >>>
> >>> for (i = 0; i < 2; i++) {
> >>> - ch = &pc->ch[i];
> >>> + ch = pc->ch[i];
> >>>
> >>> if (!ch->is_available)
> >>
> >> ...and here too.
> >
> > This is indeed a bug, I should have checked the pointer for being
> > non-NULL.
> >
> > Looking at that more closely, I think the is_available flag can be
> > entirely removed now. The allocation itself (ch != NULL) now is
> > equivalent. Do you think my reasoning is correct?
> >
> > Ouch! After writing the previous paragraph I realized you proposed this
> > a few lines below! OK, removing is_available. :)
> >
> > [...]
> >
> >> On top of this patch series, this issue doesn't happen if I apply the below
> >> change:
> >
> > [...]
> >
> >> @@ -351,7 +349,7 @@ static int imx8qxp_pc_bridge_probe(struct platform_device *pdev)
> >> free_child:
> >> of_node_put(child);
> >>
> >> - if (i == 1 && pc->ch[0]->next_bridge)
> >> + if (i == 1 && pc->ch[0])
> >> drm_bridge_remove(&pc->ch[0]->bridge);
> >
> > Unrelated to this patch, but as I looked at it more in depth now, I'm
> > not sure this whole logic is robust, even in the original code.
> >
> > The 'i == 1' check here seems to mean "if some error happened when
> > handling channel@1, that means channel@0 was successfully initialized,
> > so let's clean up channel 0".
> >
> > However my understanding of the bindings is that device tree is allowed
> > to have the channel@1 node before the channel@0 node (or even channel@1
> > without channel@0, but that's less problematic here).
> >
> > In such case (channel@1 before channel@0), this would happen:
> >
> > 1. alloc and init ch[1], all OK
> > 2. alloc and init ch[0], an error happens
> > (e.g. of_graph_get_remote_node() fails)
> >
> > So we'd reach the free_child: label, and we should call
> > drm_bridge_remove() for ch[1]->bridge, but there's no code to do that.
> >
> > To be robust in such a case, I think both channels need to be checked
> > independently, as the status of one does not imply the status of the
> > other. E.g.:
> >
> > for (i = 0; i < 2; i++)
> > if (pc->ch[i] && pc->ch[i]->next_bridge)
> > drm_bridge_remove(&pc->ch[i]->bridge);
> >
> > (which is similar to what .remove() does after the changes discussed in
> > this thread, and which I have queued for v3)
> >
> > What's your opinion? Do you think I missed anything?
>
> The pixel combiner DT node would be added in imx8-ss-dc{0,1}.dtsi, please
> see the case for imx8-ss-dc0.dtsi introduced by an in-flight patch[1]. As
> channel@{0,1} child nodes always exist(DT overlay cannot effectively delete
> any of them) and channel@0 always comes first, there is no problematic case.
I'm not questioning what existing and future dts files (will) contain,
and surely I don't see a good reason someone would write channel@1
before channel@0.
My point is:
- the bindings _allow_ channel1 before channel@0
- the error management code after the free_child label won't work
correctly if channel1 is before channel@0 in the device tree
IOW the driver is not robust against all legal device tree descriptions,
and it could be easily made robust using the example code in my
previous e-mail (quoted a few lines above).
If you agree about this I'll be happy to send a patch doing that change.
If you think I'm wrong, I won't fight a battle. This topic is
orthogonal to the change I'm introducing in this patch, and I can
continue the conversion independently from this discussion.
> > Thanks for taking the time to dig into this!
>
> After looking into this patch and patch 31(though I've already provided my A-b)
> more closely, I think the imx8qxp_pc and imx8{qm,qxp}_ldb main structures
> should have the same life time with the embedded DRM bridges, because for
> example the clk_apb clock in struct imx8qxp_pc would be accessed by the
> imx8qxp_pc_bridge_mode_set DRM bridge callback. But, IIUC, your patches extend
> the life time for the embedded channel/bridge structures only, but not for the
> main structures. What do you think ?
I see you concern, but I'm sure the change I'm introducing is not
creating the problem you are concerned about.
The key aspect is that my patch is merely changing the lifetime of the
_allocation_ of the drm_bridge, not its usage. On drm_bridge_remove()
the bridge is removed from its encoder chain and it is completely not
reachable, both before and after my patch. With my patch it is not
freed immediately, but it's just a piece of "wasted" memory that is
still allocated until elsewhere in the kernel there are pointers to it,
to avoid use-after-free.
With this explanation, do you think my patch is correct (after fixing
the bug we already discussed of course)?
Best regards,
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH v2 30/34] drm/bridge: imx8qxp-pixel-combiner: convert to devm_drm_bridge_alloc() API
2025-05-06 20:47 ` Luca Ceresoli
@ 2025-05-07 2:10 ` Liu Ying
2025-05-07 7:12 ` Luca Ceresoli
2025-05-22 3:01 ` Liu Ying
1 sibling, 1 reply; 55+ messages in thread
From: Liu Ying @ 2025-05-07 2:10 UTC (permalink / raw)
To: Luca Ceresoli
Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski,
Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32
On 05/07/2025, Luca Ceresoli wrote:
> Hello Liu,
Hi Luca,
>
> thanks for your further feedback.
>
> On Tue, 6 May 2025 10:24:18 +0800
> Liu Ying <victor.liu@nxp.com> wrote:
>
>> On 04/30/2025, Luca Ceresoli wrote:
>>> Hello Liu,
>>
>> Hi Luca,
>>
>>>
>>> On Tue, 29 Apr 2025 10:10:55 +0800
>>> Liu Ying <victor.liu@nxp.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> On 04/25/2025, Luca Ceresoli wrote:
>>>>> This is the new API for allocating DRM bridges.
>>>>>
>>>>> This driver embeds an array of channels in the main struct, and each
>>>>> channel embeds a drm_bridge. This prevents dynamic, refcount-based
>>>>> deallocation of the bridges.
>>>>>
>>>>> To make the new, dynamic bridge allocation possible:
>>>>>
>>>>> * change the array of channels into an array of channel pointers
>>>>> * allocate each channel using devm_drm_bridge_alloc()
>>>>> * adapt the code wherever using the channels
>>>>>
>>>>> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
>>>
>>> [...]
>>>
>>>>> @@ -345,8 +351,8 @@ static int imx8qxp_pc_bridge_probe(struct platform_device *pdev)
>>>>> free_child:
>>>>> of_node_put(child);
>>>>>
>>>>> - if (i == 1 && pc->ch[0].next_bridge)
>>>>> - drm_bridge_remove(&pc->ch[0].bridge);
>>>>> + if (i == 1 && pc->ch[0]->next_bridge)
>>>>
>>>> Since this patch makes pc->ch[0] and pc->ch[1] be allocated separately,
>>>> pc->ch[0] could be NULL if channel0 is not available, hence a NULL pointer
>>>> dereference here...
>>>
>>> See below for this.
>>>
>>>>> + drm_bridge_remove(&pc->ch[0]->bridge);
>>>>>
>>>>> pm_runtime_disable(dev);
>>>>> return ret;
>>>>> @@ -359,7 +365,7 @@ static void imx8qxp_pc_bridge_remove(struct platform_device *pdev)
>>>>> int i;
>>>>>
>>>>> for (i = 0; i < 2; i++) {
>>>>> - ch = &pc->ch[i];
>>>>> + ch = pc->ch[i];
>>>>>
>>>>> if (!ch->is_available)
>>>>
>>>> ...and here too.
>>>
>>> This is indeed a bug, I should have checked the pointer for being
>>> non-NULL.
>>>
>>> Looking at that more closely, I think the is_available flag can be
>>> entirely removed now. The allocation itself (ch != NULL) now is
>>> equivalent. Do you think my reasoning is correct?
>>>
>>> Ouch! After writing the previous paragraph I realized you proposed this
>>> a few lines below! OK, removing is_available. :)
>>>
>>> [...]
>>>
>>>> On top of this patch series, this issue doesn't happen if I apply the below
>>>> change:
>>>
>>> [...]
>>>
>>>> @@ -351,7 +349,7 @@ static int imx8qxp_pc_bridge_probe(struct platform_device *pdev)
>>>> free_child:
>>>> of_node_put(child);
>>>>
>>>> - if (i == 1 && pc->ch[0]->next_bridge)
>>>> + if (i == 1 && pc->ch[0])
>>>> drm_bridge_remove(&pc->ch[0]->bridge);
>>>
>>> Unrelated to this patch, but as I looked at it more in depth now, I'm
>>> not sure this whole logic is robust, even in the original code.
>>>
>>> The 'i == 1' check here seems to mean "if some error happened when
>>> handling channel@1, that means channel@0 was successfully initialized,
>>> so let's clean up channel 0".
>>>
>>> However my understanding of the bindings is that device tree is allowed
>>> to have the channel@1 node before the channel@0 node (or even channel@1
>>> without channel@0, but that's less problematic here).
>>>
>>> In such case (channel@1 before channel@0), this would happen:
>>>
>>> 1. alloc and init ch[1], all OK
>>> 2. alloc and init ch[0], an error happens
>>> (e.g. of_graph_get_remote_node() fails)
>>>
>>> So we'd reach the free_child: label, and we should call
>>> drm_bridge_remove() for ch[1]->bridge, but there's no code to do that.
>>>
>>> To be robust in such a case, I think both channels need to be checked
>>> independently, as the status of one does not imply the status of the
>>> other. E.g.:
>>>
>>> for (i = 0; i < 2; i++)
>>> if (pc->ch[i] && pc->ch[i]->next_bridge)
>>> drm_bridge_remove(&pc->ch[i]->bridge);
>>>
>>> (which is similar to what .remove() does after the changes discussed in
>>> this thread, and which I have queued for v3)
>>>
>>> What's your opinion? Do you think I missed anything?
>>
>> The pixel combiner DT node would be added in imx8-ss-dc{0,1}.dtsi, please
>> see the case for imx8-ss-dc0.dtsi introduced by an in-flight patch[1]. As
>> channel@{0,1} child nodes always exist(DT overlay cannot effectively delete
>> any of them) and channel@0 always comes first, there is no problematic case.
>
> I'm not questioning what existing and future dts files (will) contain,
> and surely I don't see a good reason someone would write channel@1
> before channel@0.
>
> My point is:
>
> - the bindings _allow_ channel1 before channel@0
> - the error management code after the free_child label won't work
> correctly if channel1 is before channel@0 in the device tree
>
> IOW the driver is not robust against all legal device tree descriptions,
> and it could be easily made robust using the example code in my
> previous e-mail (quoted a few lines above).
>
> If you agree about this I'll be happy to send a patch doing that change.
> If you think I'm wrong, I won't fight a battle. This topic is
> orthogonal to the change I'm introducing in this patch, and I can
> continue the conversion independently from this discussion.
I don't think it is necessary to do that change for now. When someone
really comes across this issue, we may make the error management code
robust.
>
>>> Thanks for taking the time to dig into this!
>>
>> After looking into this patch and patch 31(though I've already provided my A-b)
>> more closely, I think the imx8qxp_pc and imx8{qm,qxp}_ldb main structures
>> should have the same life time with the embedded DRM bridges, because for
>> example the clk_apb clock in struct imx8qxp_pc would be accessed by the
>> imx8qxp_pc_bridge_mode_set DRM bridge callback. But, IIUC, your patches extend
>> the life time for the embedded channel/bridge structures only, but not for the
>> main structures. What do you think ?
>
> I see you concern, but I'm sure the change I'm introducing is not
> creating the problem you are concerned about.
>
> The key aspect is that my patch is merely changing the lifetime of the
> _allocation_ of the drm_bridge, not its usage. On drm_bridge_remove()
> the bridge is removed from its encoder chain and it is completely not
> reachable, both before and after my patch. With my patch it is not
> freed immediately, but it's just a piece of "wasted" memory that is
> still allocated until elsewhere in the kernel there are pointers to it,
> to avoid use-after-free.
>
> With this explanation, do you think my patch is correct (after fixing
> the bug we already discussed of course)?
I tend to say your patch is not correct because we'll eventually make sure
that removing a bridge module is safe when doing atomic commit, which means
the main structures should have the same life time with the DRM bridges.
>
> Best regards,
> Luca
>
--
Regards,
Liu Ying
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH v2 30/34] drm/bridge: imx8qxp-pixel-combiner: convert to devm_drm_bridge_alloc() API
2025-05-07 2:10 ` Liu Ying
@ 2025-05-07 7:12 ` Luca Ceresoli
2025-05-07 10:16 ` Liu Ying
0 siblings, 1 reply; 55+ messages in thread
From: Luca Ceresoli @ 2025-05-07 7:12 UTC (permalink / raw)
To: Liu Ying
Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski,
Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32
Hello Liu,
On Wed, 7 May 2025 10:10:53 +0800
Liu Ying <victor.liu@nxp.com> wrote:
> On 05/07/2025, Luca Ceresoli wrote:
> > Hello Liu,
>
> Hi Luca,
>
> >
> > thanks for your further feedback.
> >
> > On Tue, 6 May 2025 10:24:18 +0800
> > Liu Ying <victor.liu@nxp.com> wrote:
> >
> >> On 04/30/2025, Luca Ceresoli wrote:
> >>> Hello Liu,
> >>
> >> Hi Luca,
> >>
> >>>
> >>> On Tue, 29 Apr 2025 10:10:55 +0800
> >>> Liu Ying <victor.liu@nxp.com> wrote:
> >>>
> >>>> Hi,
> >>>>
> >>>> On 04/25/2025, Luca Ceresoli wrote:
> >>>>> This is the new API for allocating DRM bridges.
> >>>>>
> >>>>> This driver embeds an array of channels in the main struct, and each
> >>>>> channel embeds a drm_bridge. This prevents dynamic, refcount-based
> >>>>> deallocation of the bridges.
> >>>>>
> >>>>> To make the new, dynamic bridge allocation possible:
> >>>>>
> >>>>> * change the array of channels into an array of channel pointers
> >>>>> * allocate each channel using devm_drm_bridge_alloc()
> >>>>> * adapt the code wherever using the channels
> >>>>>
> >>>>> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> >>>
> >>> [...]
> >>>
> >>>>> @@ -345,8 +351,8 @@ static int imx8qxp_pc_bridge_probe(struct platform_device *pdev)
> >>>>> free_child:
> >>>>> of_node_put(child);
> >>>>>
> >>>>> - if (i == 1 && pc->ch[0].next_bridge)
> >>>>> - drm_bridge_remove(&pc->ch[0].bridge);
> >>>>> + if (i == 1 && pc->ch[0]->next_bridge)
> >>>>
> >>>> Since this patch makes pc->ch[0] and pc->ch[1] be allocated separately,
> >>>> pc->ch[0] could be NULL if channel0 is not available, hence a NULL pointer
> >>>> dereference here...
> >>>
> >>> See below for this.
> >>>
> >>>>> + drm_bridge_remove(&pc->ch[0]->bridge);
> >>>>>
> >>>>> pm_runtime_disable(dev);
> >>>>> return ret;
> >>>>> @@ -359,7 +365,7 @@ static void imx8qxp_pc_bridge_remove(struct platform_device *pdev)
> >>>>> int i;
> >>>>>
> >>>>> for (i = 0; i < 2; i++) {
> >>>>> - ch = &pc->ch[i];
> >>>>> + ch = pc->ch[i];
> >>>>>
> >>>>> if (!ch->is_available)
> >>>>
> >>>> ...and here too.
> >>>
> >>> This is indeed a bug, I should have checked the pointer for being
> >>> non-NULL.
> >>>
> >>> Looking at that more closely, I think the is_available flag can be
> >>> entirely removed now. The allocation itself (ch != NULL) now is
> >>> equivalent. Do you think my reasoning is correct?
> >>>
> >>> Ouch! After writing the previous paragraph I realized you proposed this
> >>> a few lines below! OK, removing is_available. :)
> >>>
> >>> [...]
> >>>
> >>>> On top of this patch series, this issue doesn't happen if I apply the below
> >>>> change:
> >>>
> >>> [...]
> >>>
> >>>> @@ -351,7 +349,7 @@ static int imx8qxp_pc_bridge_probe(struct platform_device *pdev)
> >>>> free_child:
> >>>> of_node_put(child);
> >>>>
> >>>> - if (i == 1 && pc->ch[0]->next_bridge)
> >>>> + if (i == 1 && pc->ch[0])
> >>>> drm_bridge_remove(&pc->ch[0]->bridge);
> >>>
> >>> Unrelated to this patch, but as I looked at it more in depth now, I'm
> >>> not sure this whole logic is robust, even in the original code.
> >>>
> >>> The 'i == 1' check here seems to mean "if some error happened when
> >>> handling channel@1, that means channel@0 was successfully initialized,
> >>> so let's clean up channel 0".
> >>>
> >>> However my understanding of the bindings is that device tree is allowed
> >>> to have the channel@1 node before the channel@0 node (or even channel@1
> >>> without channel@0, but that's less problematic here).
> >>>
> >>> In such case (channel@1 before channel@0), this would happen:
> >>>
> >>> 1. alloc and init ch[1], all OK
> >>> 2. alloc and init ch[0], an error happens
> >>> (e.g. of_graph_get_remote_node() fails)
> >>>
> >>> So we'd reach the free_child: label, and we should call
> >>> drm_bridge_remove() for ch[1]->bridge, but there's no code to do that.
> >>>
> >>> To be robust in such a case, I think both channels need to be checked
> >>> independently, as the status of one does not imply the status of the
> >>> other. E.g.:
> >>>
> >>> for (i = 0; i < 2; i++)
> >>> if (pc->ch[i] && pc->ch[i]->next_bridge)
> >>> drm_bridge_remove(&pc->ch[i]->bridge);
> >>>
> >>> (which is similar to what .remove() does after the changes discussed in
> >>> this thread, and which I have queued for v3)
> >>>
> >>> What's your opinion? Do you think I missed anything?
> >>
> >> The pixel combiner DT node would be added in imx8-ss-dc{0,1}.dtsi, please
> >> see the case for imx8-ss-dc0.dtsi introduced by an in-flight patch[1]. As
> >> channel@{0,1} child nodes always exist(DT overlay cannot effectively delete
> >> any of them) and channel@0 always comes first, there is no problematic case.
> >
> > I'm not questioning what existing and future dts files (will) contain,
> > and surely I don't see a good reason someone would write channel@1
> > before channel@0.
> >
> > My point is:
> >
> > - the bindings _allow_ channel1 before channel@0
> > - the error management code after the free_child label won't work
> > correctly if channel1 is before channel@0 in the device tree
> >
> > IOW the driver is not robust against all legal device tree descriptions,
> > and it could be easily made robust using the example code in my
> > previous e-mail (quoted a few lines above).
> >
> > If you agree about this I'll be happy to send a patch doing that change.
> > If you think I'm wrong, I won't fight a battle. This topic is
> > orthogonal to the change I'm introducing in this patch, and I can
> > continue the conversion independently from this discussion.
>
> I don't think it is necessary to do that change for now. When someone
> really comes across this issue, we may make the error management code
> robust.
>
> >
> >>> Thanks for taking the time to dig into this!
> >>
> >> After looking into this patch and patch 31(though I've already provided my A-b)
> >> more closely, I think the imx8qxp_pc and imx8{qm,qxp}_ldb main structures
> >> should have the same life time with the embedded DRM bridges, because for
> >> example the clk_apb clock in struct imx8qxp_pc would be accessed by the
> >> imx8qxp_pc_bridge_mode_set DRM bridge callback. But, IIUC, your patches extend
> >> the life time for the embedded channel/bridge structures only, but not for the
> >> main structures. What do you think ?
> >
> > I see you concern, but I'm sure the change I'm introducing is not
> > creating the problem you are concerned about.
> >
> > The key aspect is that my patch is merely changing the lifetime of the
> > _allocation_ of the drm_bridge, not its usage. On drm_bridge_remove()
> > the bridge is removed from its encoder chain and it is completely not
> > reachable, both before and after my patch. With my patch it is not
> > freed immediately, but it's just a piece of "wasted" memory that is
> > still allocated until elsewhere in the kernel there are pointers to it,
> > to avoid use-after-free.
> >
> > With this explanation, do you think my patch is correct (after fixing
> > the bug we already discussed of course)?
>
> I tend to say your patch is not correct because we'll eventually make sure
> that removing a bridge module is safe when doing atomic commit,
I think your sentence can be rephrased as "your patch is correct with
the current code base where bridges are not (yet) removable, but there
will be a problem when they start to actually be removable".
Is my understanding correct? If it is, I agree on that sentence.
The work to have removable bridges is massive and non-trivial, so it
will need to be tackled in steps. The grand plan [0] is:
1. add refcounting to DRM bridges (struct drm_bridge)
2. handle gracefully atomic updates during bridge removal
3. avoid DSI host drivers to have dangling pointers to DSI devices
4. finish the hotplug bridge work, removing the "always-disconnected"
connector, moving code to the core and potentially removing the
hotplug-bridge itself (this needs to be clarified as points 1-3 are
developed)
I am at step 1 right now. Removal during atomic updates is step 2,
ideas about how to implement that are already being discussed [1],
there's a practical plan proposed by Maxime with the goal of reaching
removable bridges without breaking things along the path.
[0] https://lore.kernel.org/lkml/20250206-hotplug-drm-bridge-v6-0-9d6f2c9c3058@bootlin.com/
[1] https://lore.kernel.org/all/20250106-vigorous-talented-viper-fa49d9@houat/
> which means
> the main structures should have the same life time with the DRM bridges.
The word "lifetime" mean two things for bridges:
* the time span during which memory is allocated for a struct
drm_bridge (along with the embedding struct)
* the time span during which a DRM bridge is active/used/usable as
part of a card
- i.e. when it is part of an encoder chain
- i.e. when drm_bridge_funcs callbacks can be called
- i.e. from drm_bridge_add() to drm_bridge_remove()
These two lifetimes used to be nearly the same. Now the "memory
allocation lifetime" is extended, but the "bridge existence" is
unchanged: drm_bridge_add() to drm_bridge_remove() are called in the
same place and do the same things, so the bridge will stop being in any
encoder chain at the exact same time. now we are just keeping a piece of
memory allocated for a longer time.
Seen in another way, the events used to be:
* probe:
- allocate bridge
- drm_bridge_add()
* remove
- drm_bridge_remove()
- now the bridge is not used, it's just some dead memory [*]
- kfree bridge (either in .remove() or just after by devm)
Now it becomes:
* probe:
- allocate bridge
- drm_bridge_add()
* remove
- drm_bridge_remove()
- now the bridge is not used, it's just some dead memory [*]
- maybe some more time, possibly long, until the last put [*]
- kfree bridge (by devm)
The duration of the [*] steps changes, but it's harmless because the
bridge is not used at all. No change except for memory allocation.
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH v2 30/34] drm/bridge: imx8qxp-pixel-combiner: convert to devm_drm_bridge_alloc() API
2025-05-07 7:12 ` Luca Ceresoli
@ 2025-05-07 10:16 ` Liu Ying
2025-05-07 14:13 ` Luca Ceresoli
0 siblings, 1 reply; 55+ messages in thread
From: Liu Ying @ 2025-05-07 10:16 UTC (permalink / raw)
To: Luca Ceresoli
Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski,
Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32
On 05/07/2025, Luca Ceresoli wrote:
> Hello Liu,
>
> On Wed, 7 May 2025 10:10:53 +0800
> Liu Ying <victor.liu@nxp.com> wrote:
>
>> On 05/07/2025, Luca Ceresoli wrote:
>>> Hello Liu,
>>
>> Hi Luca,
>>
>>>
>>> thanks for your further feedback.
>>>
>>> On Tue, 6 May 2025 10:24:18 +0800
>>> Liu Ying <victor.liu@nxp.com> wrote:
>>>
>>>> On 04/30/2025, Luca Ceresoli wrote:
>>>>> Hello Liu,
>>>>
>>>> Hi Luca,
>>>>
>>>>>
>>>>> On Tue, 29 Apr 2025 10:10:55 +0800
>>>>> Liu Ying <victor.liu@nxp.com> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> On 04/25/2025, Luca Ceresoli wrote:
>>>>>>> This is the new API for allocating DRM bridges.
>>>>>>>
>>>>>>> This driver embeds an array of channels in the main struct, and each
>>>>>>> channel embeds a drm_bridge. This prevents dynamic, refcount-based
>>>>>>> deallocation of the bridges.
>>>>>>>
>>>>>>> To make the new, dynamic bridge allocation possible:
>>>>>>>
>>>>>>> * change the array of channels into an array of channel pointers
>>>>>>> * allocate each channel using devm_drm_bridge_alloc()
>>>>>>> * adapt the code wherever using the channels
>>>>>>>
>>>>>>> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
>>>>>
>>>>> [...]
>>>>>
>>>>>>> @@ -345,8 +351,8 @@ static int imx8qxp_pc_bridge_probe(struct platform_device *pdev)
>>>>>>> free_child:
>>>>>>> of_node_put(child);
>>>>>>>
>>>>>>> - if (i == 1 && pc->ch[0].next_bridge)
>>>>>>> - drm_bridge_remove(&pc->ch[0].bridge);
>>>>>>> + if (i == 1 && pc->ch[0]->next_bridge)
>>>>>>
>>>>>> Since this patch makes pc->ch[0] and pc->ch[1] be allocated separately,
>>>>>> pc->ch[0] could be NULL if channel0 is not available, hence a NULL pointer
>>>>>> dereference here...
>>>>>
>>>>> See below for this.
>>>>>
>>>>>>> + drm_bridge_remove(&pc->ch[0]->bridge);
>>>>>>>
>>>>>>> pm_runtime_disable(dev);
>>>>>>> return ret;
>>>>>>> @@ -359,7 +365,7 @@ static void imx8qxp_pc_bridge_remove(struct platform_device *pdev)
>>>>>>> int i;
>>>>>>>
>>>>>>> for (i = 0; i < 2; i++) {
>>>>>>> - ch = &pc->ch[i];
>>>>>>> + ch = pc->ch[i];
>>>>>>>
>>>>>>> if (!ch->is_available)
>>>>>>
>>>>>> ...and here too.
>>>>>
>>>>> This is indeed a bug, I should have checked the pointer for being
>>>>> non-NULL.
>>>>>
>>>>> Looking at that more closely, I think the is_available flag can be
>>>>> entirely removed now. The allocation itself (ch != NULL) now is
>>>>> equivalent. Do you think my reasoning is correct?
>>>>>
>>>>> Ouch! After writing the previous paragraph I realized you proposed this
>>>>> a few lines below! OK, removing is_available. :)
>>>>>
>>>>> [...]
>>>>>
>>>>>> On top of this patch series, this issue doesn't happen if I apply the below
>>>>>> change:
>>>>>
>>>>> [...]
>>>>>
>>>>>> @@ -351,7 +349,7 @@ static int imx8qxp_pc_bridge_probe(struct platform_device *pdev)
>>>>>> free_child:
>>>>>> of_node_put(child);
>>>>>>
>>>>>> - if (i == 1 && pc->ch[0]->next_bridge)
>>>>>> + if (i == 1 && pc->ch[0])
>>>>>> drm_bridge_remove(&pc->ch[0]->bridge);
>>>>>
>>>>> Unrelated to this patch, but as I looked at it more in depth now, I'm
>>>>> not sure this whole logic is robust, even in the original code.
>>>>>
>>>>> The 'i == 1' check here seems to mean "if some error happened when
>>>>> handling channel@1, that means channel@0 was successfully initialized,
>>>>> so let's clean up channel 0".
>>>>>
>>>>> However my understanding of the bindings is that device tree is allowed
>>>>> to have the channel@1 node before the channel@0 node (or even channel@1
>>>>> without channel@0, but that's less problematic here).
>>>>>
>>>>> In such case (channel@1 before channel@0), this would happen:
>>>>>
>>>>> 1. alloc and init ch[1], all OK
>>>>> 2. alloc and init ch[0], an error happens
>>>>> (e.g. of_graph_get_remote_node() fails)
>>>>>
>>>>> So we'd reach the free_child: label, and we should call
>>>>> drm_bridge_remove() for ch[1]->bridge, but there's no code to do that.
>>>>>
>>>>> To be robust in such a case, I think both channels need to be checked
>>>>> independently, as the status of one does not imply the status of the
>>>>> other. E.g.:
>>>>>
>>>>> for (i = 0; i < 2; i++)
>>>>> if (pc->ch[i] && pc->ch[i]->next_bridge)
>>>>> drm_bridge_remove(&pc->ch[i]->bridge);
>>>>>
>>>>> (which is similar to what .remove() does after the changes discussed in
>>>>> this thread, and which I have queued for v3)
>>>>>
>>>>> What's your opinion? Do you think I missed anything?
>>>>
>>>> The pixel combiner DT node would be added in imx8-ss-dc{0,1}.dtsi, please
>>>> see the case for imx8-ss-dc0.dtsi introduced by an in-flight patch[1]. As
>>>> channel@{0,1} child nodes always exist(DT overlay cannot effectively delete
>>>> any of them) and channel@0 always comes first, there is no problematic case.
>>>
>>> I'm not questioning what existing and future dts files (will) contain,
>>> and surely I don't see a good reason someone would write channel@1
>>> before channel@0.
>>>
>>> My point is:
>>>
>>> - the bindings _allow_ channel1 before channel@0
>>> - the error management code after the free_child label won't work
>>> correctly if channel1 is before channel@0 in the device tree
>>>
>>> IOW the driver is not robust against all legal device tree descriptions,
>>> and it could be easily made robust using the example code in my
>>> previous e-mail (quoted a few lines above).
>>>
>>> If you agree about this I'll be happy to send a patch doing that change.
>>> If you think I'm wrong, I won't fight a battle. This topic is
>>> orthogonal to the change I'm introducing in this patch, and I can
>>> continue the conversion independently from this discussion.
>>
>> I don't think it is necessary to do that change for now. When someone
>> really comes across this issue, we may make the error management code
>> robust.
>>
>>>
>>>>> Thanks for taking the time to dig into this!
>>>>
>>>> After looking into this patch and patch 31(though I've already provided my A-b)
>>>> more closely, I think the imx8qxp_pc and imx8{qm,qxp}_ldb main structures
>>>> should have the same life time with the embedded DRM bridges, because for
>>>> example the clk_apb clock in struct imx8qxp_pc would be accessed by the
>>>> imx8qxp_pc_bridge_mode_set DRM bridge callback. But, IIUC, your patches extend
>>>> the life time for the embedded channel/bridge structures only, but not for the
>>>> main structures. What do you think ?
>>>
>>> I see you concern, but I'm sure the change I'm introducing is not
>>> creating the problem you are concerned about.
>>>
>>> The key aspect is that my patch is merely changing the lifetime of the
>>> _allocation_ of the drm_bridge, not its usage. On drm_bridge_remove()
>>> the bridge is removed from its encoder chain and it is completely not
>>> reachable, both before and after my patch. With my patch it is not
>>> freed immediately, but it's just a piece of "wasted" memory that is
>>> still allocated until elsewhere in the kernel there are pointers to it,
>>> to avoid use-after-free.
>>>
>>> With this explanation, do you think my patch is correct (after fixing
>>> the bug we already discussed of course)?
>>
>> I tend to say your patch is not correct because we'll eventually make sure
>> that removing a bridge module is safe when doing atomic commit,
>
> I think your sentence can be rephrased as "your patch is correct with
> the current code base where bridges are not (yet) removable, but there
> will be a problem when they start to actually be removable".
>
> Is my understanding correct? If it is, I agree on that sentence.
Nope, I meant your patch should align the life times of the main structures
and the DRM bridges, for the sake of the kinda long term goal - remove bridge
driver module safely when doing atomic commit.
>
> The work to have removable bridges is massive and non-trivial, so it
> will need to be tackled in steps. The grand plan [0] is:
>
> 1. add refcounting to DRM bridges (struct drm_bridge)
> 2. handle gracefully atomic updates during bridge removal
> 3. avoid DSI host drivers to have dangling pointers to DSI devices
> 4. finish the hotplug bridge work, removing the "always-disconnected"
> connector, moving code to the core and potentially removing the
> hotplug-bridge itself (this needs to be clarified as points 1-3 are
> developed)
I'm busy with internal things these days and cannot look into the grand
plan and steps closely, sorry about that.
>
> I am at step 1 right now. Removal during atomic updates is step 2,
> ideas about how to implement that are already being discussed [1],
> there's a practical plan proposed by Maxime with the goal of reaching
> removable bridges without breaking things along the path.
>
> [0] https://lore.kernel.org/lkml/20250206-hotplug-drm-bridge-v6-0-9d6f2c9c3058@bootlin.com/
> [1] https://lore.kernel.org/all/20250106-vigorous-talented-viper-fa49d9@houat/
>
>> which means
>> the main structures should have the same life time with the DRM bridges.
>
> The word "lifetime" mean two things for bridges:
>
> * the time span during which memory is allocated for a struct
> drm_bridge (along with the embedding struct)
Note that with your patch set the imx8*-ldb drivers and this bridge driver
won't allocate the DRM bridge along with the embedding struct. This makes
me worry, because maybe these drivers are the only "special" ones in this
patch set and I don't want them to be "special" after your patch set is
applied.
> * the time span during which a DRM bridge is active/used/usable as
> part of a card
> - i.e. when it is part of an encoder chain
> - i.e. when drm_bridge_funcs callbacks can be called
> - i.e. from drm_bridge_add() to drm_bridge_remove()
>
> These two lifetimes used to be nearly the same. Now the "memory
> allocation lifetime" is extended, but the "bridge existence" is
> unchanged: drm_bridge_add() to drm_bridge_remove() are called in the
> same place and do the same things, so the bridge will stop being in any
> encoder chain at the exact same time. now we are just keeping a piece of
> memory allocated for a longer time.
>
> Seen in another way, the events used to be:
>
> * probe:
> - allocate bridge
> - drm_bridge_add()
>
> * remove
> - drm_bridge_remove()
> - now the bridge is not used, it's just some dead memory [*]
> - kfree bridge (either in .remove() or just after by devm)
>
> Now it becomes:
>
> * probe:
> - allocate bridge
> - drm_bridge_add()
>
> * remove
> - drm_bridge_remove()
> - now the bridge is not used, it's just some dead memory [*]
> - maybe some more time, possibly long, until the last put [*]
> - kfree bridge (by devm)
>
> The duration of the [*] steps changes, but it's harmless because the
> bridge is not used at all. No change except for memory allocation.
>
> Luca
>
--
Regards,
Liu Ying
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH v2 30/34] drm/bridge: imx8qxp-pixel-combiner: convert to devm_drm_bridge_alloc() API
2025-05-07 10:16 ` Liu Ying
@ 2025-05-07 14:13 ` Luca Ceresoli
0 siblings, 0 replies; 55+ messages in thread
From: Luca Ceresoli @ 2025-05-07 14:13 UTC (permalink / raw)
To: Liu Ying
Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski,
Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32
Hello Liu,
On Wed, 7 May 2025 18:16:28 +0800
Liu Ying <victor.liu@nxp.com> wrote:
[...]
> >>>> After looking into this patch and patch 31(though I've already provided my A-b)
> >>>> more closely, I think the imx8qxp_pc and imx8{qm,qxp}_ldb main structures
> >>>> should have the same life time with the embedded DRM bridges, because for
> >>>> example the clk_apb clock in struct imx8qxp_pc would be accessed by the
> >>>> imx8qxp_pc_bridge_mode_set DRM bridge callback. But, IIUC, your patches extend
> >>>> the life time for the embedded channel/bridge structures only, but not for the
> >>>> main structures. What do you think ?
> >>>
> >>> I see you concern, but I'm sure the change I'm introducing is not
> >>> creating the problem you are concerned about.
> >>>
> >>> The key aspect is that my patch is merely changing the lifetime of the
> >>> _allocation_ of the drm_bridge, not its usage. On drm_bridge_remove()
> >>> the bridge is removed from its encoder chain and it is completely not
> >>> reachable, both before and after my patch. With my patch it is not
> >>> freed immediately, but it's just a piece of "wasted" memory that is
> >>> still allocated until elsewhere in the kernel there are pointers to it,
> >>> to avoid use-after-free.
> >>>
> >>> With this explanation, do you think my patch is correct (after fixing
> >>> the bug we already discussed of course)?
> >>
> >> I tend to say your patch is not correct because we'll eventually make sure
> >> that removing a bridge module is safe when doing atomic commit,
> >
> > I think your sentence can be rephrased as "your patch is correct with
> > the current code base where bridges are not (yet) removable, but there
> > will be a problem when they start to actually be removable".
> >
> > Is my understanding correct? If it is, I agree on that sentence.
>
> Nope, I meant your patch should align the life times of the main structures
> and the DRM bridges, for the sake of the kinda long term goal - remove bridge
> driver module safely when doing atomic commit.
Again, I don't think there is any bug introduced by this patch (once
the NULL ptr deref bug we already discussed is fixed). No bridge can be
removed as of now, with or without this patch.
You concern that this patch would make things more complex in the
future, when bridges will actually become removable and they could be
during atomic updates. But about this...
> > The work to have removable bridges is massive and non-trivial, so it
> > will need to be tackled in steps. The grand plan [0] is:
> >
> > 1. add refcounting to DRM bridges (struct drm_bridge)
> > 2. handle gracefully atomic updates during bridge removal
> > 3. avoid DSI host drivers to have dangling pointers to DSI devices
> > 4. finish the hotplug bridge work, removing the "always-disconnected"
> > connector, moving code to the core and potentially removing the
> > hotplug-bridge itself (this needs to be clarified as points 1-3 are
> > developed)
>
> I'm busy with internal things these days and cannot look into the grand
> plan and steps closely, sorry about that.
...I'll wait until you have time to look into that more closely. There
is just no way to understand this whole topic without some dedicated
attention, which takes time unavoidably.
In the meanwhile I am going to send v3 soon with the known bug fixed,
so the best version is available to continue this discussion.
> > I am at step 1 right now. Removal during atomic updates is step 2,
> > ideas about how to implement that are already being discussed [1],
> > there's a practical plan proposed by Maxime with the goal of reaching
> > removable bridges without breaking things along the path.
> >
> > [0] https://lore.kernel.org/lkml/20250206-hotplug-drm-bridge-v6-0-9d6f2c9c3058@bootlin.com/
> > [1] https://lore.kernel.org/all/20250106-vigorous-talented-viper-fa49d9@houat/
> >
> >> which means
> >> the main structures should have the same life time with the DRM bridges.
> >
> > The word "lifetime" mean two things for bridges:
> >
> > * the time span during which memory is allocated for a struct
> > drm_bridge (along with the embedding struct)
>
> Note that with your patch set the imx8*-ldb drivers and this bridge driver
> won't allocate the DRM bridge along with the embedding struct.
By "embedding struct" I mean the struct imx8qxp_pc_channel that embeds
the struct drm_bridge. Sorry, I realize my wording was ambiguous.
> This makes
> me worry, because maybe these drivers are the only "special" ones in this
> patch set and I don't want them to be "special" after your patch set is
> applied.
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH v2 30/34] drm/bridge: imx8qxp-pixel-combiner: convert to devm_drm_bridge_alloc() API
2025-05-06 20:47 ` Luca Ceresoli
2025-05-07 2:10 ` Liu Ying
@ 2025-05-22 3:01 ` Liu Ying
2025-05-26 7:20 ` Luca Ceresoli
1 sibling, 1 reply; 55+ messages in thread
From: Liu Ying @ 2025-05-22 3:01 UTC (permalink / raw)
To: Luca Ceresoli
Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski,
Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32
On 05/07/2025, Luca Ceresoli wrote:
[...]
>> After looking into this patch and patch 31(though I've already provided my A-b)
>> more closely, I think the imx8qxp_pc and imx8{qm,qxp}_ldb main structures
>> should have the same life time with the embedded DRM bridges, because for
>> example the clk_apb clock in struct imx8qxp_pc would be accessed by the
>> imx8qxp_pc_bridge_mode_set DRM bridge callback. But, IIUC, your patches extend
>> the life time for the embedded channel/bridge structures only, but not for the
>> main structures. What do you think ?
>
> I see you concern, but I'm sure the change I'm introducing is not
> creating the problem you are concerned about.
>
> The key aspect is that my patch is merely changing the lifetime of the
> _allocation_ of the drm_bridge, not its usage. On drm_bridge_remove()
> the bridge is removed from its encoder chain and it is completely not
> reachable, both before and after my patch. With my patch it is not
drm_bridge_remove() only removes a bridge from the global bridge_list defined
in drm_bridge.c. drm_bridge_detach() is the one which removes a bridge from
it's encoder chain. It looks like you wrongly thought drm_bridge_remove()
is drm_bridge_detach(). So, even if drm_bridge_remove() is called, the removed
bridge could still be in it's encoder chain, hence an atomic commit could still
access the allocated bridge(with lifetime extended) and the clock_apb clock
for example in struct imx8qxp_pc could also be accessed. That's why I think
the main structures should have the same lifetime with the allocated bridge.
> freed immediately, but it's just a piece of "wasted" memory that is
> still allocated until elsewhere in the kernel there are pointers to it,
> to avoid use-after-free.
>
> With this explanation, do you think my patch is correct (after fixing
> the bug we already discussed of course)?
>
> Best regards,
> Luca
>
--
Regards,
Liu Ying
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH v2 30/34] drm/bridge: imx8qxp-pixel-combiner: convert to devm_drm_bridge_alloc() API
2025-05-22 3:01 ` Liu Ying
@ 2025-05-26 7:20 ` Luca Ceresoli
2025-05-27 1:42 ` Liu Ying
0 siblings, 1 reply; 55+ messages in thread
From: Luca Ceresoli @ 2025-05-26 7:20 UTC (permalink / raw)
To: Liu Ying
Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski,
Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32
Hello Liu,
On Thu, 22 May 2025 11:01:13 +0800
Liu Ying <victor.liu@nxp.com> wrote:
> On 05/07/2025, Luca Ceresoli wrote:
>
> [...]
>
> >> After looking into this patch and patch 31(though I've already provided my A-b)
> >> more closely, I think the imx8qxp_pc and imx8{qm,qxp}_ldb main structures
> >> should have the same life time with the embedded DRM bridges, because for
> >> example the clk_apb clock in struct imx8qxp_pc would be accessed by the
> >> imx8qxp_pc_bridge_mode_set DRM bridge callback. But, IIUC, your patches extend
> >> the life time for the embedded channel/bridge structures only, but not for the
> >> main structures. What do you think ?
> >
> > I see you concern, but I'm sure the change I'm introducing is not
> > creating the problem you are concerned about.
> >
> > The key aspect is that my patch is merely changing the lifetime of the
> > _allocation_ of the drm_bridge, not its usage. On drm_bridge_remove()
> > the bridge is removed from its encoder chain and it is completely not
> > reachable, both before and after my patch. With my patch it is not
>
> drm_bridge_remove() only removes a bridge from the global bridge_list defined
> in drm_bridge.c. drm_bridge_detach() is the one which removes a bridge from
> it's encoder chain. It looks like you wrongly thought drm_bridge_remove()
> is drm_bridge_detach().
Indeed my sentence was inaccurate, sorry about that.
> So, even if drm_bridge_remove() is called, the removed
> bridge could still be in it's encoder chain, hence an atomic commit could still
> access the allocated bridge(with lifetime extended) and the clock_apb clock
> for example in struct imx8qxp_pc could also be accessed. That's why I think
> the main structures should have the same lifetime with the allocated bridge.
As the long-term goal is to allow bridges to be hot-removable,
decoupling the lifetime of the various components is a necessary step.
Definitely it will open other issues, and especially the removal during
atomic updates. This has been discussed already, and there is a
proposed plan to handle it.
First, here is the grand plan (mentioned in the v3 cover letter):
1. ➜ add refcounting to DRM bridges (struct drm_bridge)
2. handle gracefully atomic updates during bridge removal
3. avoid DSI host drivers to have dangling pointers to DSI devices
4. finally, let bridges be removable (depends on 1+2+3)
We are now at step 1. Your concern, as I understand it, will be
addressed at step 2. Bridges won't be removable until step 4, so the
current changes are not introducing a misbehavior but rather preparing
the ground with all the necessary infrastructure changes.
Step 2 was discussed in the past [0], and the idea proposed by Maxime
is to introduce a "gone" or "unplugged" flag and drm_bridge_enter() /
drm_bridge_exit() functions. The principle is the same as struct
drm_device.unplugged and drm_dev_enter/exit().
In a nutshell the idea is:
- drm_bridge.unplugged is initialized to false
- drm_bridge_enter() returns false if drm_bridge.unplugged == true
- any code holding a pointer to the bridge (including the bridge driver
itself) and operating on the bridge (including removal) needs to do:
if (drm_bridge_enter()) {
do something;
drm_bridge_exit();
}
- when the bridge is removed, the driver removal function sets
dev_bridge.unplugged = true
The "do something" above includes any access to device resources,
including clocks (and clk_apb).
In other words, two pieces of code can not access the bridge structure
at the same time. This includes bridge removal VS any atomic operations.
Do you think this addresses your concern?
For you to have a better picture of the path, here's an additional
clarification about drm_bridge_attach/detach() and
drm_bridge_add/remove(). As part of step 1 of the grand plan, both of
them will drm_bridge_get/put() the bridge, so that no bridge is freed
if it is either in the global bridge_list or in any encoder chain.
Patches for this are already approved by Maxime [1][2]. They cannot be
applied until all bridge drivers have been converted to the new
devm_drm_bridge_alloc() API, so they depend on this series to be
completely applied. We are getting pretty close: as of now the entire
series has been applied except for this and another driver.
[0] https://lore.kernel.org/all/20250129125153.35d0487a@booty/t/#u
[1] https://patchwork.freedesktop.org/patch/643095/
[2] https://patchwork.freedesktop.org/patch/643096/
Best regards,
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: [PATCH v2 30/34] drm/bridge: imx8qxp-pixel-combiner: convert to devm_drm_bridge_alloc() API
2025-05-26 7:20 ` Luca Ceresoli
@ 2025-05-27 1:42 ` Liu Ying
0 siblings, 0 replies; 55+ messages in thread
From: Liu Ying @ 2025-05-27 1:42 UTC (permalink / raw)
To: Luca Ceresoli
Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Jagan Teki,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Douglas Anderson, Chun-Kuang Hu, Krzysztof Kozlowski,
Anusha Srivatsa, Paul Kocialkowski, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, asahi, linux-kernel, chrome-platform,
imx, linux-arm-kernel, linux-mediatek, linux-amlogic,
linux-renesas-soc, platform-driver-x86, linux-samsung-soc,
linux-arm-msm, freedreno, linux-stm32
On 05/26/2025, Luca Ceresoli wrote:
> Hello Liu,
Hi Luca,
>
> On Thu, 22 May 2025 11:01:13 +0800
> Liu Ying <victor.liu@nxp.com> wrote:
>
>> On 05/07/2025, Luca Ceresoli wrote:
>>
>> [...]
>>
>>>> After looking into this patch and patch 31(though I've already provided my A-b)
>>>> more closely, I think the imx8qxp_pc and imx8{qm,qxp}_ldb main structures
>>>> should have the same life time with the embedded DRM bridges, because for
>>>> example the clk_apb clock in struct imx8qxp_pc would be accessed by the
>>>> imx8qxp_pc_bridge_mode_set DRM bridge callback. But, IIUC, your patches extend
>>>> the life time for the embedded channel/bridge structures only, but not for the
>>>> main structures. What do you think ?
>>>
>>> I see you concern, but I'm sure the change I'm introducing is not
>>> creating the problem you are concerned about.
>>>
>>> The key aspect is that my patch is merely changing the lifetime of the
>>> _allocation_ of the drm_bridge, not its usage. On drm_bridge_remove()
>>> the bridge is removed from its encoder chain and it is completely not
>>> reachable, both before and after my patch. With my patch it is not
>>
>> drm_bridge_remove() only removes a bridge from the global bridge_list defined
>> in drm_bridge.c. drm_bridge_detach() is the one which removes a bridge from
>> it's encoder chain. It looks like you wrongly thought drm_bridge_remove()
>> is drm_bridge_detach().
>
> Indeed my sentence was inaccurate, sorry about that.
>
>> So, even if drm_bridge_remove() is called, the removed
>> bridge could still be in it's encoder chain, hence an atomic commit could still
>> access the allocated bridge(with lifetime extended) and the clock_apb clock
>> for example in struct imx8qxp_pc could also be accessed. That's why I think
>> the main structures should have the same lifetime with the allocated bridge.
>
> As the long-term goal is to allow bridges to be hot-removable,
> decoupling the lifetime of the various components is a necessary step.
> Definitely it will open other issues, and especially the removal during
> atomic updates. This has been discussed already, and there is a
> proposed plan to handle it.
>
> First, here is the grand plan (mentioned in the v3 cover letter):
>
> 1. ➜ add refcounting to DRM bridges (struct drm_bridge)
> 2. handle gracefully atomic updates during bridge removal
> 3. avoid DSI host drivers to have dangling pointers to DSI devices
> 4. finally, let bridges be removable (depends on 1+2+3)
>
> We are now at step 1. Your concern, as I understand it, will be
> addressed at step 2. Bridges won't be removable until step 4, so the
> current changes are not introducing a misbehavior but rather preparing
> the ground with all the necessary infrastructure changes.
>
> Step 2 was discussed in the past [0], and the idea proposed by Maxime
> is to introduce a "gone" or "unplugged" flag and drm_bridge_enter() /
> drm_bridge_exit() functions. The principle is the same as struct
> drm_device.unplugged and drm_dev_enter/exit().
>
> In a nutshell the idea is:
>
> - drm_bridge.unplugged is initialized to false
> - drm_bridge_enter() returns false if drm_bridge.unplugged == true
> - any code holding a pointer to the bridge (including the bridge driver
> itself) and operating on the bridge (including removal) needs to do:
> if (drm_bridge_enter()) {
> do something;
> drm_bridge_exit();
> }
> - when the bridge is removed, the driver removal function sets
> dev_bridge.unplugged = true
>
> The "do something" above includes any access to device resources,
> including clocks (and clk_apb).
>
> In other words, two pieces of code can not access the bridge structure
> at the same time. This includes bridge removal VS any atomic operations.
>
> Do you think this addresses your concern?
Yes, drm_bridge_{enter,exit} address it.
>
>
> For you to have a better picture of the path, here's an additional
> clarification about drm_bridge_attach/detach() and
> drm_bridge_add/remove(). As part of step 1 of the grand plan, both of
> them will drm_bridge_get/put() the bridge, so that no bridge is freed
> if it is either in the global bridge_list or in any encoder chain.
>
> Patches for this are already approved by Maxime [1][2]. They cannot be
> applied until all bridge drivers have been converted to the new
> devm_drm_bridge_alloc() API, so they depend on this series to be
> completely applied. We are getting pretty close: as of now the entire
> series has been applied except for this and another driver.
>
> [0] https://lore.kernel.org/all/20250129125153.35d0487a@booty/t/#u
> [1] https://patchwork.freedesktop.org/patch/643095/
> [2] https://patchwork.freedesktop.org/patch/643096/
>
> Best regards,
> Luca
>
--
Regards,
Liu Ying
^ permalink raw reply [flat|nested] 55+ messages in thread
end of thread, other threads:[~2025-05-27 1:43 UTC | newest]
Thread overview: 55+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20250424-drm-bridge-convert-to-alloc-api-v2-0-8f91a404d86b@bootlin.com>
2025-04-24 18:59 ` [PATCH v2 02/34] platform: arm64: acer-aspire1-ec: convert to devm_drm_bridge_alloc() API Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 03/34] drm/bridge: analogix-anx6345: " Luca Ceresoli
2025-04-28 12:29 ` Andy Yan
2025-04-24 18:59 ` [PATCH v2 04/34] drm/bridge: anx7625: " Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 05/34] drm/bridge: cdns-dsi: " Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 06/34] drm/bridge: display-connector: " Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 07/34] drm/bridge: lt9611uxc: " Luca Ceresoli
2025-04-29 12:09 ` Dmitry Baryshkov
2025-04-24 18:59 ` [PATCH v2 08/34] drm/bridge: megachips-stdpxxxx-ge-b850v3-fw: " Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 09/34] drm/bridge: nxp-ptn3460: " Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 10/34] drm/bridge: sii902x: " Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 11/34] drm/bridge: dw-hdmi: " Luca Ceresoli
2025-04-24 19:16 ` Cristian Ciocaltea
2025-04-24 18:59 ` [PATCH v2 12/34] drm/bridge: tda998x: " Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 13/34] drm/bridge: ti-sn65dsi86: " Luca Ceresoli
2025-04-28 20:53 ` Doug Anderson
2025-04-24 18:59 ` [PATCH v2 14/34] drm/exynos: mic: " Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 15/34] drm/mcde: " Luca Ceresoli
2025-04-29 8:40 ` Linus Walleij
2025-04-24 18:59 ` [PATCH v2 16/34] drm/msm/dp: " Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 17/34] drm/msm/dsi: " Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 18/34] drm/msm/hdmi: " Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 19/34] drm/omap: dss: dpi: " Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 20/34] drm/omap: dss: dsi: " Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 21/34] drm/omap: dss: hdmi4: " Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 22/34] drm/omap: dss: hdmi5: " Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 23/34] drm/omap: dss: sdi: " Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 24/34] drm/omap: dss: venc: " Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 25/34] drm/rcar-du: dsi: " Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 26/34] drm/bridge: stm_lvds: " Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 27/34] drm/vc4: " Luca Ceresoli
2025-04-28 15:45 ` Dave Stevenson
2025-04-24 18:59 ` [PATCH v2 28/34] drm/sti: dvo: " Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 29/34] drm: zynqmp_dp: " Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 30/34] drm/bridge: imx8qxp-pixel-combiner: " Luca Ceresoli
2025-04-29 2:10 ` Liu Ying
2025-04-30 9:29 ` Luca Ceresoli
2025-05-06 2:24 ` Liu Ying
2025-05-06 20:47 ` Luca Ceresoli
2025-05-07 2:10 ` Liu Ying
2025-05-07 7:12 ` Luca Ceresoli
2025-05-07 10:16 ` Liu Ying
2025-05-07 14:13 ` Luca Ceresoli
2025-05-22 3:01 ` Liu Ying
2025-05-26 7:20 ` Luca Ceresoli
2025-05-27 1:42 ` Liu Ying
2025-04-24 18:59 ` [PATCH v2 31/34] drm/bridge: imx8*-ldb: " Luca Ceresoli
2025-04-29 2:35 ` Liu Ying
2025-04-24 18:59 ` [PATCH v2 32/34] drm/bridge: tc358767: " Luca Ceresoli
2025-04-24 18:59 ` [PATCH v2 33/34] drm/bridge: add devm_drm_put_bridge() Luca Ceresoli
2025-04-24 20:05 ` [PATCH v2 34/34] drm/bridge: panel: convert to devm_drm_bridge_alloc() API Luca Ceresoli
2025-04-28 11:39 ` Maxime Ripard
2025-04-28 15:25 ` Luca Ceresoli
2025-05-05 6:23 ` Maxime Ripard
2025-05-05 15:20 ` Luca Ceresoli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).