Re: [PATCH] drm: bridge: ldb: add support for using channel 1 only

From: Marek Vasut
Date: Wed Apr 05 2023 - 08:31:39 EST


On 4/5/23 09:30, Luca Ceresoli wrote:

[...]

@@ -311,10 +314,23 @@ static int fsl_ldb_probe(struct platform_device *pdev)
if (IS_ERR(fsl_ldb->regmap))
return PTR_ERR(fsl_ldb->regmap);
- /* Locate the panel DT node. */
- panel_node = of_graph_get_remote_node(dev->of_node, 1, 0);
- if (!panel_node)
- return -ENXIO;
+ /* 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);
+ fsl_ldb->ch0_enabled = (remote1 != NULL);
+ fsl_ldb->ch1_enabled = (remote2 != NULL);
+ panel_node = of_node_get(remote1 ? remote1 : remote2);

You can even do this without the middle 'remote1' I think:

panel_node = of_node_get(remote1 ? : remote2);

Apparently, but honestly with such short expressions clearly having no
side effects I think it's not helping readability.

I think even the ternary operator itself isn't helpful much, but that's a matter of taste, and I don't have a better suggestion which would improve the readability either (I tried to expand it into if()... but that looks bad too).

No need to change anything.

[...]

Thanks for the patch.