Re: [PATCH v2 07/11] drm/bridge: lt9611: switch to of_drm_get_bridge_by_endpoint()

Luca Ceresoli
2026-04-28T13:53:47Z

On Tue Apr 28, 2026 at 3:18 PM CEST, Gyeyoung Baek wrote:
>>
>> @@ -1058,7 +1057,11 @@ static int lt9611_parse_dt(struct device *dev,
>>
>> lt9611->ac_mode = of_property_read_bool(dev->of_node, "lt,ac-mode");
>>
>> - return drm_of_find_panel_or_bridge(dev->of_node, 2, -1, NULL, &lt9611->next_bridge);
>> + lt9611->bridge.next_bridge = of_drm_get_bridge_by_endpoint(dev->of_node, 2, -1);
>> + if (IS_ERR(lt9611->bridge.next_bridge))
>> + return PTR_ERR(lt9611->bridge.next_bridge);
>> +
>> + return 0;
>> }
>
> Hello Luca,
> Could you take a look at this alternative?
> ------
> struct drm_bridge *next_bridge =
> of_drm_get_bridge_by_endpoint(dev->of_node, 2, -1);
>
> if (IS_ERR(next_bridge))
> return PTR_ERR(next_bridge);
>
> lt9611->bridge.next_bridge = next_bridge;
> return 0;
> ------
>
> I think it reads a bit cleaner and avoids holding the ERR_PTR in the struct.

Yes, but more verbose.

Based on this and the patch 8 fallback reported by Biju, I started
wondering whether the v1 version of this function, while being a bit ugly,
was leading to cleaner code... An example: [0].

Dmitry, your opinion?

[0] https://lore.kernel.org/all/20260413-drm-bridge-alloc-getput-panel_or_bridge-v1-6-acd01cd79a1f@bootlin.com/

Luca

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering