[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251216-cute-bandicoot-of-authority-3c492a@penduick>
Date: Tue, 16 Dec 2025 14:49:39 +0100
From: Maxime Ripard <mripard@...nel.org>
To: Luca Ceresoli <luca.ceresoli@...tlin.com>
Cc: Andrzej Hajda <andrzej.hajda@...el.com>,
Neil Armstrong <neil.armstrong@...aro.org>, Robert Foss <rfoss@...nel.org>,
Laurent Pinchart <Laurent.pinchart@...asonboard.com>, Jonas Karlman <jonas@...boo.se>,
Jernej Skrabec <jernej.skrabec@...il.com>, Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Thomas Zimmermann <tzimmermann@...e.de>, David Airlie <airlied@...il.com>,
Simona Vetter <simona@...ll.ch>, Jonathan Corbet <corbet@....net>,
Alexey Brodkin <abrodkin@...opsys.com>, Phong LE <ple@...libre.com>, Liu Ying <victor.liu@....com>,
Shawn Guo <shawnguo@...nel.org>, Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>, Fabio Estevam <festevam@...il.com>,
Adrien Grassein <adrien.grassein@...il.com>, Laurent Pinchart <laurent.pinchart+renesas@...asonboard.com>,
Tomi Valkeinen <tomi.valkeinen+renesas@...asonboard.com>, Kieran Bingham <kieran.bingham+renesas@...asonboard.com>,
Geert Uytterhoeven <geert+renesas@...der.be>, Magnus Damm <magnus.damm@...il.com>,
Kevin Hilman <khilman@...libre.com>, Jerome Brunet <jbrunet@...libre.com>,
Martin Blumenstingl <martin.blumenstingl@...glemail.com>, Chun-Kuang Hu <chunkuang.hu@...nel.org>,
Philipp Zabel <p.zabel@...gutronix.de>, Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>, Anitha Chrisanthus <anitha.chrisanthus@...el.com>,
Edmund Dea <edmund.j.dea@...el.com>, Inki Dae <inki.dae@...sung.com>,
Seung-Woo Kim <sw0312.kim@...sung.com>, Kyungmin Park <kyungmin.park@...sung.com>,
Krzysztof Kozlowski <krzk@...nel.org>, Alim Akhtar <alim.akhtar@...sung.com>,
Hui Pu <Hui.Pu@...ealthcare.com>, Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org, linux-doc@...r.kernel.org,
imx@...ts.linux.dev, linux-arm-kernel@...ts.infradead.org,
linux-renesas-soc@...r.kernel.org, linux-amlogic@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, linux-samsung-soc@...r.kernel.org
Subject: Re: [PATCH 06/26] drm/bridge: add devm_drm_of_find_bridge
On Mon, Dec 15, 2025 at 03:11:21PM +0100, Luca Ceresoli wrote:
> Hi Maxime,
>
> On Mon Dec 15, 2025 at 11:35 AM CET, Maxime Ripard wrote:
> [...]
> >> > Additionally, as a matter of fact there are currently drivers storing
> >> > bridge pointers. The next_bridge is the most common case. Code using
> >> > drm_bridge_connector_init() for example can store up to eight of them, but
> >> > individual drivers are the hardest to hunt for.
> >> >
> >> > I can see these (potential) tools to handle this (not mutually exclusive):
> >> >
> >> > 1. remove drm_bridge pointers pointing to other bridges
> >> > 2. check whether a bridge (say B) still exists before any dereference
> >> > to B->another_bridge: that's drm_bridge_enter/exit()
> >> > 3. let owners of bridge pointers be notified when a bridge is unplugged,
> >> > so they can actively put their reference and clear their pointer
> >> >
> >> > For item 1, I think the drm_of_bridge_attach() idea quoted above would
> >> > work, at least for the simple cases where bridge drivers use the
> >> > next_bridge only for attach. A next_bridge pointer in struct drm_bridge is
> >> > not even needed in that case, the pointer would be computed from OF when
> >> > needed and not stored. I can do an experiment and send a first series, do
> >> > you think it would be useful?
> >>
> >> I had a look and, while the implementation should be simple, only a few
> >> drivers could benefit right now. The majority fall into one of these
> >> categories:
> >>
> >> * drivers using drm_of_find_panel_or_bridge() or *_of_get_bridge()
> >> (maybe 60-80% of all drivers, those will have to wait for the panel
> >> improvements)
> >> * drivers using the next_bridge pointer for more than just attach
> >> * drivers doing more complicated stuff
> >>
> >> I think your "put next_bridge in __drm_bridge_free" idea would fit well the
> >> 2nd category and perhaps also the 1st one. For the 3rd category we'd need
> >> something different, e.g. a per-driver .destroy callback.
> >
> > Yep, that's fine. We should optimize for the common case, with an escape
> > hatch. That's exactly what we are talking about here.
>
> Not sure why, but it's taking a while before I grasp your ideas about this
> series and meld them with mine. I hopefully got a clear POV now, so based
> on it my plan is to rework this series to:
>
> * keep drm_of_find_bridge() but renamed to of_drm_get_bridge(), and keep
> patches 1-5 (with the changes suggested by you and Louis, nothing big
> and all already sent in v2)
I don't think we should use that name, but on principle, yes.
> * not add devm_drm_of_find_bridge()
Yep.
> * add next_bridge pointer to struct drm_bridge and call
> drm_bridge_put(bridge->next_bridge) in __drm_bridge_free, document it
We don't have to at this point, you can add next_bridge to the
drm_bridge pointer if you want, but I don't consider it a prerequisite.
If we don't we would have to create drm_bridge_funcs->destroy
implemnentations to give up the driver pointer reference though. Your
call.
> * convert patches 7-26 to use bridge->next_bridge where applicable,
> or to do something different when needed
Depending on your decision above, we'd need to either convert them to
use drm_bridge->next_bridge or create a destroy hook for them. Either
way is fine for me.
> * maybe remove part of patches 7-26 just to reduce spam and rework effort
> in case of further iterations, to send them separately once the approach
> is accepted
>
> Does it look OK?
Yep
Maxime
Download attachment "signature.asc" of type "application/pgp-signature" (274 bytes)
Powered by blists - more mailing lists