drm/bridge: make of_drm_find_bridge() a wrapper of of_drm_find_and_get_bridge()

of_drm_find_bridge() is identical to of_drm_find_and_get_bridge() except it
does not increment the refcount. Rewrite it as a wrapper and put the bridge
being returned so the behaviour is still the same.

Reviewed-by: Maxime Ripard <mripard@kernel.org>
Link: https://patch.msgid.link/20251216-drm-bridge-alloc-getput-drm_of_find_bridge-v3-4-b5165fab8058@bootlin.com
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
This commit is contained in:
Luca Ceresoli
2025-12-16 18:58:37 +01:00
parent c637217efb
commit 5d7cb36254

View File

@@ -1529,19 +1529,17 @@ EXPORT_SYMBOL(of_drm_find_and_get_bridge);
*/
struct drm_bridge *of_drm_find_bridge(struct device_node *np)
{
struct drm_bridge *bridge;
struct drm_bridge *bridge = of_drm_find_and_get_bridge(np);
mutex_lock(&bridge_lock);
/*
* We need to emulate the original semantics of
* of_drm_find_bridge(), which was not getting any bridge
* reference. Being now based on of_drm_find_and_get_bridge() which
* gets a reference, put it before returning.
*/
drm_bridge_put(bridge);
list_for_each_entry(bridge, &bridge_list, list) {
if (bridge->of_node == np) {
mutex_unlock(&bridge_lock);
return bridge;
}
}
mutex_unlock(&bridge_lock);
return NULL;
return bridge;
}
EXPORT_SYMBOL(of_drm_find_bridge);
#endif