[PATCH v2 04/26] drm/bridge: make of_drm_find_bridge() a wrapper of of_drm_get_bridge()
Randy Dunlap
rdunlap at infradead.org
Fri Nov 28 13:50:19 PST 2025
On 11/28/25 8:50 AM, Luca Ceresoli wrote:
> of_drm_find_bridge() is identical to of_drm_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.
>
> Signed-off-by: Luca Ceresoli <luca.ceresoli at bootlin.com>
>
> ---
>
> Changed in v2:
> - Added comment to document why we put the reference
> ---
> drivers/gpu/drm/drm_bridge.c | 20 +++++++++-----------
> 1 file changed, 9 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
> index 21a84715d221..9b7e3f859973 100644
> --- a/drivers/gpu/drm/drm_bridge.c
> +++ b/drivers/gpu/drm/drm_bridge.c
> @@ -1467,19 +1467,17 @@ EXPORT_SYMBOL(of_drm_get_bridge);
> */
> struct drm_bridge *of_drm_find_bridge(struct device_node *np)
> {
> - struct drm_bridge *bridge;
> -
> - mutex_lock(&bridge_lock);
> + struct drm_bridge *bridge = of_drm_get_bridge(np);
>
> - list_for_each_entry(bridge, &bridge_list, list) {
> - if (bridge->of_node == np) {
> - mutex_unlock(&bridge_lock);
> - return bridge;
> - }
> - }
> + /**
This isn't a kernel-doc comment, so please don't use "/**" here.
Just use "/*".
> + * 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_get_bridge() which gets a
> + * reference, put it before returning.
> + */
> + drm_bridge_put(bridge);
>
> - mutex_unlock(&bridge_lock);
> - return NULL;
> + return bridge;
> }
> EXPORT_SYMBOL(of_drm_find_bridge);
> #endif
>
--
~Randy
More information about the linux-amlogic
mailing list