Commit 5d7cb362 authored by Luca Ceresoli's avatar Luca Ceresoli
Browse files

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: default avatarMaxime 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: default avatarLuca Ceresoli <luca.ceresoli@bootlin.com>
parent c637217e
Loading
Loading
Loading
Loading
+9 −11
Original line number Diff line number Diff line
@@ -1529,20 +1529,18 @@ 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;
}
EXPORT_SYMBOL(of_drm_find_bridge);
#endif