From: Luca Ceresoli <luca.ceresoli@bootlin.com>
To: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/4] drm/mode_object: add drm_mode_object_read_refcount()
Date: Thu, 7 Nov 2024 09:31:57 +0100 [thread overview]
Message-ID: <20241107093157.64750c19@booty> (raw)
In-Reply-To: <87wmhgfu2r.fsf@intel.com>
Hello Jani,
On Wed, 06 Nov 2024 14:03:08 +0200
Jani Nikula <jani.nikula@linux.intel.com> wrote:
> On Wed, 06 Nov 2024, Luca Ceresoli <luca.ceresoli@bootlin.com> wrote:
> > Add a wrapper to kref_read() just like the ones already in place for
> > kref_get() and kref_put(). This will be used for sanity checks on object
> > lifetime.
> >
> > Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> > ---
> > drivers/gpu/drm/drm_mode_object.c | 20 ++++++++++++++++++++
> > include/drm/drm_mode_object.h | 1 +
> > 2 files changed, 21 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/drm_mode_object.c b/drivers/gpu/drm/drm_mode_object.c
> > index df4cc0e8e263d5887a799cf1a61d998234be7158..f990cc7e9b5d3bda3453123593314fa1ea2bf923 100644
> > --- a/drivers/gpu/drm/drm_mode_object.c
> > +++ b/drivers/gpu/drm/drm_mode_object.c
> > @@ -217,6 +217,26 @@ void drm_mode_object_get(struct drm_mode_object *obj)
> > }
> > EXPORT_SYMBOL(drm_mode_object_get);
> >
> > +/**
> > + * drm_mode_object_get - read the refcount for a mode object
> > + * @obj: DRM mode object
> > + *
> > + * This function returns the current object's refcount if it is a
> > + * refcounted modeset object, or 0 on any other object.
>
> Returns: The current object's ...
>
> > + */
> > +unsigned int drm_mode_object_read_refcount(struct drm_mode_object *obj)
> > +{
> > + unsigned int refcount = 0;
> > +
> > + if (obj->free_cb) {
> > + refcount = kref_read(&obj->refcount);
> > + DRM_DEBUG("OBJ ID: %d (%d)\n", obj->id, refcount);
>
> Please ditch the debug.
OK, will do both in v3.
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2024-11-07 8:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-06 10:48 [PATCH v2 0/4] DRM: small improvements Luca Ceresoli
2024-11-06 10:48 ` [PATCH v2 1/4] drm/drm_mode_object: fix typo in kerneldoc Luca Ceresoli
2024-11-06 10:48 ` [PATCH v2 2/4] drm/atomic-helper: improve CRTC enabled/connectors mismatch logging message Luca Ceresoli
2024-11-09 7:28 ` Dmitry Baryshkov
2024-11-06 10:48 ` [PATCH v2 3/4] drm/mode_object: add drm_mode_object_read_refcount() Luca Ceresoli
2024-11-06 12:03 ` Jani Nikula
2024-11-07 8:31 ` Luca Ceresoli [this message]
2024-11-06 16:19 ` kernel test robot
2024-11-06 10:48 ` [PATCH v2 4/4] drm/connector: warn when cleaning up a refcounted connector Luca Ceresoli
2024-11-07 13:55 ` Dmitry Baryshkov
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=20241107093157.64750c19@booty \
--to=luca.ceresoli@bootlin.com \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.