lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250526135141.5a84185c@booty>
Date: Mon, 26 May 2025 13:51:41 +0200
From: Luca Ceresoli <luca.ceresoli@...tlin.com>
To: Maxime Ripard <mripard@...nel.org>
Cc: Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>, Thomas Zimmermann
 <tzimmermann@...e.de>, David Airlie <airlied@...il.com>, Simona Vetter
 <simona@...ll.ch>, 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>, Anusha
 Srivatsa <asrivats@...hat.com>, Paul Kocialkowski <paulk@...-base.io>,
 Dmitry Baryshkov <lumag@...nel.org>, Hervé Codina
 <herve.codina@...tlin.com>, Hui Pu <Hui.Pu@...ealthcare.com>, Thomas
 Petazzoni <thomas.petazzoni@...tlin.com>, dri-devel@...ts.freedesktop.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH v8 2/3] dmr/bridge: add a .destroy func

Hi Maxime,

On Thu, 22 May 2025 17:43:37 +0200
Maxime Ripard <mripard@...nel.org> wrote:

> On Fri, May 16, 2025 at 06:48:38PM +0200, Luca Ceresoli wrote:
> > Some users of DRM bridges may need to execute specific code just before
> > deallocation.
> > 
> > As of now the only known user would be KUnit tests.
> > 
> > Suggested-by: Maxime Ripard <mripard@...nel.org>
> > Signed-off-by: Luca Ceresoli <luca.ceresoli@...tlin.com>
> > 
> > ---
> > 
> > This patch is new in v8. The .destroy callback had appeared in v5 as well
> > [5], but as part of a larger patch and for different reason that do not
> > apply anymore.
> > 
> > [5] https://lore.kernel.org/all/20241231-hotplug-drm-bridge-v5-3-173065a1ece1@bootlin.com/#t
> > ---
> >  drivers/gpu/drm/drm_bridge.c |  2 ++
> >  include/drm/drm_bridge.h     | 10 ++++++++++
> >  2 files changed, 12 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
> > index b4c89ec01998b849018ce031c7cd84614e65e710..6185cb29fe3162264f0912c09c205fb467975dee 100644
> > --- a/drivers/gpu/drm/drm_bridge.c
> > +++ b/drivers/gpu/drm/drm_bridge.c
> > @@ -203,6 +203,8 @@ static void __drm_bridge_free(struct kref *kref)
> >  {
> >  	struct drm_bridge *bridge = container_of(kref, struct drm_bridge, refcount);
> >  
> > +	if (bridge->funcs->destroy)
> > +		bridge->funcs->destroy(bridge);
> >  	kfree(bridge->container);
> >  }
> >  
> > diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
> > index 4e418a29a9ff9d014d6ac0910a5d9bcf7118195e..3ccd493faa580845c2ed1166f398eca27b464261 100644
> > --- a/include/drm/drm_bridge.h
> > +++ b/include/drm/drm_bridge.h
> > @@ -86,6 +86,16 @@ struct drm_bridge_funcs {
> >  	 */
> >  	void (*detach)(struct drm_bridge *bridge);
> >  
> > +	/**
> > +	 * @destroy:
> > +	 *
> > +	 * This callback is invoked when the bridge is about to be
> > +	 * deallocated.
> > +	 *
> > +	 * The @destroy callback is optional.
> > +	 */
> > +	void (*destroy)(struct drm_bridge *bridge);
> > +  
> 
> destroy is before detach in alphabetical order, but otherwise it looks
> good to me.

I saw the struct is not alpha-ordered right now, so I did not get it
should be, and it looked like keeping .attach and .detach nearby would
be good.

> Once fixed,
> Acked-by: Maxime Ripard <mripard@...nel.org>

OK, will send new iteration with .destroy before .detach, thanks for
the review.

Luca

-- 
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ