Re: [PATCH v6 02/10] drm/bridge: Set firmware node of drm_bridge instances automatically

From: Dmitry Baryshkov
Date: Sun May 26 2024 - 17:19:16 EST


On Mon, May 27, 2024 at 04:21:07AM +0800, Sui Jingfeng wrote:
> Normally, the drm_bridge::of_node won't be used by bridge driver instances
> themselves. Rather, it is mainly used by other modules to find associated
> drm bridge drvier. Therefore, adding a drm bridge to the global bridge list
> and setting 'of_node' field of a drm bridge share the same goal. Both are
> for finding purpose, therefore better to group them to one function.
>
> Update the drm_bridge_add() interface and implementation to achieve such
> goal atomically, new implementation will fetch the device node from the
> backing device of the drm bridge driver automatically. For the majority
> cases, which is one device backing one drm bridge driver, this model works
> well. Drivers still can set it manually by passing NULL if this model
> doesn't fit.
>
> While at it, Add a 'struct device *' pointer to the drm_bridge structure.
> As it already being passed in by both of drm_bridge_add() and
> devm_drm_bridge_add(). A lot of driver instances has already added it into
> their derived structure, promote it into drm_bridge core helps to reduce
> a batch of boilerplates.
>
> Signed-off-by: Sui Jingfeng <sui.jingfeng@xxxxxxxxx>
> ---

[trimmed]

> @@ -231,7 +243,7 @@ static void drm_bridge_remove_void(void *bridge)
> */
> int devm_drm_bridge_add(struct device *dev, struct drm_bridge *bridge)
> {
> - drm_bridge_add(bridge);
> + drm_bridge_add(bridge, dev);
> return devm_add_action_or_reset(dev, drm_bridge_remove_void, bridge);

This breaks aux-hpd-bridge, which gets of_node as an external pointer
rather than dev->of_node.


--
With best wishes
Dmitry