mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/bridge: fsl-ldb: Remove panel naming and use scoped device_node cleanup
@ 2026-10-30 16:32 Laurentiu Palcu
  2026-11-04 17:56 ` Luca Ceresoli
  0 siblings, 1 reply; 2+ messages in thread
From: Laurentiu Palcu @ 2026-10-30 16:32 UTC (permalink / raw)
  To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
	Jonas Karlman, Jernej Skrabec, Luca Ceresoli, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter
  Cc: Laurentiu Palcu, dri-devel, linux-kernel

The remote endpoint node is not necessarily a panel, so drop the "panel"
naming and refer to the next bridge instead. Update the error message
printed when no output port is connected.

While at it, convert the device_node handling in fsl_ldb_probe() to use
the __free(device_node) cleanup helper. Since remote1 and remote2 now
stay valid until the function returns, pass the selected one directly to
of_drm_find_and_get_bridge() and drop the extra panel_node reference.
Do the same for the dual-link port1/port2 lookups.

No functional change intended, other than the updated error message.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
---
 drivers/gpu/drm/bridge/fsl-ldb.c | 31 ++++++++++++-------------------
 1 file changed, 12 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/bridge/fsl-ldb.c b/drivers/gpu/drm/bridge/fsl-ldb.c
index e5eb4e6a24a4f..1077ef946430a 100644
--- a/drivers/gpu/drm/bridge/fsl-ldb.c
+++ b/drivers/gpu/drm/bridge/fsl-ldb.c
@@ -305,8 +305,6 @@ static const struct drm_bridge_funcs funcs = {
 static int fsl_ldb_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
-	struct device_node *panel_node;
-	struct device_node *remote1, *remote2;
 	struct fsl_ldb *fsl_ldb;
 	int dual_link;
 
@@ -329,19 +327,16 @@ static int fsl_ldb_probe(struct platform_device *pdev)
 	if (IS_ERR(fsl_ldb->regmap))
 		return PTR_ERR(fsl_ldb->regmap);
 
-	/* Locate the remote ports and the panel node */
-	remote1 = of_graph_get_remote_node(dev->of_node, 1, 0);
-	remote2 = of_graph_get_remote_node(dev->of_node, 2, 0);
+	/* Locate the remote ports */
+	struct device_node *remote1 __free(device_node) =
+				of_graph_get_remote_node(dev->of_node, 1, 0);
+	struct device_node *remote2 __free(device_node) =
+				of_graph_get_remote_node(dev->of_node, 2, 0);
 	fsl_ldb->ch0_enabled = (remote1 != NULL);
 	fsl_ldb->ch1_enabled = (remote2 != NULL);
-	panel_node = of_node_get(remote1 ? remote1 : remote2);
-	of_node_put(remote1);
-	of_node_put(remote2);
 
-	if (!fsl_ldb->ch0_enabled && !fsl_ldb->ch1_enabled) {
-		of_node_put(panel_node);
-		return dev_err_probe(dev, -ENXIO, "No panel node found");
-	}
+	if (!fsl_ldb->ch0_enabled && !fsl_ldb->ch1_enabled)
+		return dev_err_probe(dev, -ENXIO, "No next bridge node found\n");
 
 	dev_dbg(dev, "Using %s\n",
 		fsl_ldb_is_dual(fsl_ldb) ? "dual-link mode" :
@@ -350,19 +345,17 @@ static int fsl_ldb_probe(struct platform_device *pdev)
 	if (of_property_present(dev->of_node, "nxp,enable-termination-resistor"))
 		fsl_ldb->use_termination_resistor = true;
 
-	fsl_ldb->bridge.next_bridge = of_drm_find_and_get_bridge(panel_node);
-	of_node_put(panel_node);
+	fsl_ldb->bridge.next_bridge = of_drm_find_and_get_bridge(remote1 ?: remote2);
 	if (!fsl_ldb->bridge.next_bridge)
 		return -EPROBE_DEFER;
 
 	if (fsl_ldb_is_dual(fsl_ldb)) {
-		struct device_node *port1, *port2;
+		struct device_node *port1 __free(device_node) =
+				of_graph_get_port_by_id(dev->of_node, 1);
+		struct device_node *port2 __free(device_node) =
+				of_graph_get_port_by_id(dev->of_node, 2);
 
-		port1 = of_graph_get_port_by_id(dev->of_node, 1);
-		port2 = of_graph_get_port_by_id(dev->of_node, 2);
 		dual_link = drm_of_lvds_get_dual_link_pixel_order(port1, port2);
-		of_node_put(port1);
-		of_node_put(port2);
 
 		if (dual_link < 0)
 			return dev_err_probe(dev, dual_link,
-- 
2.53.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/bridge: fsl-ldb: Remove panel naming and use scoped device_node cleanup
  2026-10-30 16:32 [PATCH] drm/bridge: fsl-ldb: Remove panel naming and use scoped device_node cleanup Laurentiu Palcu
@ 2026-11-04 17:56 ` Luca Ceresoli
  0 siblings, 0 replies; 2+ messages in thread
From: Luca Ceresoli @ 2026-11-04 17:56 UTC (permalink / raw)
  To: Laurentiu Palcu, Andrzej Hajda, Neil Armstrong, Robert Foss,
	Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Luca Ceresoli,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Simona Vetter
  Cc: dri-devel, linux-kernel

On Fri Oct 30, 2026 at 5:32 PM CET, Laurentiu Palcu wrote:
> The remote endpoint node is not necessarily a panel, so drop the "panel"
> naming and refer to the next bridge instead. Update the error message
> printed when no output port is connected.
>
> While at it, convert the device_node handling in fsl_ldb_probe() to use
> the __free(device_node) cleanup helper. Since remote1 and remote2 now
> stay valid until the function returns, pass the selected one directly to
> of_drm_find_and_get_bridge() and drop the extra panel_node reference.
> Do the same for the dual-link port1/port2 lookups.
>
> No functional change intended, other than the updated error message.
>
> Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>

I wanted to test this patch but it does not apply on current
drm-misc-next. Can you rebase and resend it?

BTW the content looks good, so if you only do trivial changes in v2 you can add:

+Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>

Luca

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-04 17:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-30 16:32 [PATCH] drm/bridge: fsl-ldb: Remove panel naming and use scoped device_node cleanup Laurentiu Palcu
2026-11-04 17:56 ` Luca Ceresoli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®