dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Luca Ceresoli <luca.ceresoli@bootlin.com>
To: Maxime Ripard <mripard@kernel.org>
Cc: "Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Andrzej Hajda" <andrzej.hajda@intel.com>,
	"Neil Armstrong" <neil.armstrong@linaro.org>,
	"Robert Foss" <rfoss@kernel.org>,
	"Laurent Pinchart" <Laurent.pinchart@ideasonboard.com>,
	"Jonas Karlman" <jonas@kwiboo.se>,
	"Jernej Skrabec" <jernej.skrabec@gmail.com>,
	"Anusha Srivatsa" <asrivats@redhat.com>,
	"Paul Kocialkowski" <paulk@sys-base.io>,
	"Dmitry Baryshkov" <lumag@kernel.org>,
	"Hervé Codina" <herve.codina@bootlin.com>,
	"Hui Pu" <Hui.Pu@gehealthcare.com>,
	"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v8 2/3] dmr/bridge: add a .destroy func
Date: Mon, 26 May 2025 13:51:41 +0200	[thread overview]
Message-ID: <20250526135141.5a84185c@booty> (raw)
In-Reply-To: <20250522-hot-hopeful-smilodon-dfb5b6@houat>

Hi Maxime,

On Thu, 22 May 2025 17:43:37 +0200
Maxime Ripard <mripard@kernel.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@kernel.org>
> > Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.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@kernel.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

  reply	other threads:[~2025-05-26 11:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-16 16:48 [PATCH v8 0/3] drm/bridge: add kunit tests for devm_drm_bridge_alloc() Luca Ceresoli
2025-05-16 16:48 ` [PATCH v8 1/3] drm/tests: bridge: convert to devm_drm_bridge_alloc() API Luca Ceresoli
2025-05-27 16:06   ` Maxime Ripard
2025-05-28 22:41   ` Anusha Srivatsa
2025-05-16 16:48 ` [PATCH v8 2/3] dmr/bridge: add a .destroy func Luca Ceresoli
2025-05-22 15:43   ` Maxime Ripard
2025-05-26 11:51     ` Luca Ceresoli [this message]
2025-05-28 22:46       ` Anusha Srivatsa
2025-05-16 16:48 ` [PATCH v8 3/3] drm/tests: bridge: add KUnit tests for devm_drm_bridge_alloc() Luca Ceresoli
2025-05-27 16:10   ` Maxime Ripard
2025-06-05 18:31     ` Luca Ceresoli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250526135141.5a84185c@booty \
    --to=luca.ceresoli@bootlin.com \
    --cc=Hui.Pu@gehealthcare.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=airlied@gmail.com \
    --cc=andrzej.hajda@intel.com \
    --cc=asrivats@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=herve.codina@bootlin.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lumag@kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=paulk@sys-base.io \
    --cc=rfoss@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).