[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250725-holistic-ambrosial-jellyfish-f41f6b@houat>
Date: Fri, 25 Jul 2025 16:15:23 +0200
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>, 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>, Tomi Valkeinen <tomi.valkeinen@...asonboard.com>,
Philipp Zabel <p.zabel@...gutronix.de>, Hui Pu <Hui.Pu@...ealthcare.com>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>, linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org,
imx@...ts.linux.dev, linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH 4/9] drm/omapdrm: use drm_bridge_chain_get_last_bridge()
On Mon, Jul 14, 2025 at 12:32:40PM +0200, Luca Ceresoli wrote:
> Hi Maxime,
>
> On Thu, 10 Jul 2025 09:13:46 +0200
> Maxime Ripard <mripard@...nel.org> wrote:
>
> > On Wed, Jul 09, 2025 at 06:48:03PM +0200, Luca Ceresoli wrote:
> > > Use drm_bridge_chain_get_last_bridge() instead of open coding a loop with
> > > two invocations of drm_bridge_get_next_bridge() per iteration.
> > >
> > > Besides being cleaner and more efficient, this change is necessary in
> > > preparation for drm_bridge_get_next_bridge() to get a reference to the
> > > returned bridge.
> > >
> > > Signed-off-by: Luca Ceresoli <luca.ceresoli@...tlin.com>
> > > ---
> > > drivers/gpu/drm/omapdrm/omap_drv.c | 8 ++++----
> > > 1 file changed, 4 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
> > > index 054b71dba6a75b8c42198c4b102a093f43a675a2..3bbcec01428a6f290afdfa40ef6f79629539a584 100644
> > > --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> > > +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> > > @@ -378,12 +378,12 @@ static int omap_display_id(struct omap_dss_device *output)
> > > struct device_node *node = NULL;
> > >
> > > if (output->bridge) {
> > > - struct drm_bridge *bridge = output->bridge;
> > > -
> > > - while (drm_bridge_get_next_bridge(bridge))
> > > - bridge = drm_bridge_get_next_bridge(bridge);
> > > + struct drm_bridge *bridge =
> > > + drm_bridge_chain_get_last_bridge(output->bridge->encoder);
> > >
> > > node = bridge->of_node;
> > > +
> > > + drm_bridge_put(bridge);
> >
> > Any reason you're not using __free(drm_bridge_put) here?
>
> Just because the code is simple enough that an explicit
> drm_bridge_put() is clearly sufficient.
>
> Do you think __free() should be used even in such trivial cases?
It's a matter of opinion at this point :)
It' makes it a bit easier and consistent so that's why I raised it, but
if you feel like it's too much, that's fine by me as well.
Maxime
Download attachment "signature.asc" of type "application/pgp-signature" (274 bytes)
Powered by blists - more mailing lists