From: Luben Tuikov <luben.tuikov@amd.com>
To: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Cc: Alexander Deucher <Alexander.Deucher@amd.com>,
Luben Tuikov <luben.tuikov@amd.com>,
Xinhui.Pan@amd.com
Subject: [PATCH 1/3] drm: No warn for drivers who provide release
Date: Tue, 1 Sep 2020 21:06:43 -0400 [thread overview]
Message-ID: <20200902010645.26943-2-luben.tuikov@amd.com> (raw)
In-Reply-To: <20200902010645.26943-1-luben.tuikov@amd.com>
Drivers usually allocate their container
struct at PCI probe time, then call drm_dev_init(),
which initializes the contained DRM dev kref to 1.
A DRM driver may provide their own kref
release method, which frees the container
object, the container of the DRM device,
on the last "put" which usually comes
after the PCI device has been freed
with PCI and with DRM.
If a driver has provided their own "release"
method in the drm_driver structure, then
do not check "managed.final_kfree", and thus
do not splat a WARN_ON in the kernel log
when a driver which implements "release"
is loaded.
This patch adds this one-line check.
Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
---
drivers/gpu/drm/drm_drv.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 13068fdf4331..952455dedb8c 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -935,7 +935,8 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)
if (!driver->load)
drm_mode_config_validate(dev);
- WARN_ON(!dev->managed.final_kfree);
+ if (!driver->release)
+ WARN_ON(!dev->managed.final_kfree);
if (drm_dev_needs_global_mutex(dev))
mutex_lock(&drm_global_mutex);
--
2.28.0.394.ge197136389
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2020-09-02 1:07 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-02 1:06 [PATCH 0/3] Use implicit kref infra Luben Tuikov
2020-09-02 1:06 ` Luben Tuikov [this message]
2020-09-02 1:06 ` [PATCH 2/3] drm/amdgpu: Remove drmm final free Luben Tuikov
2020-09-02 1:06 ` [PATCH 3/3] drm/amdgpu: Remove superfluous NULL check Luben Tuikov
2020-09-02 6:59 ` Daniel Vetter
2020-09-02 7:21 ` Christian König
2020-09-02 1:42 ` [PATCH 0/3] Use implicit kref infra Pan, Xinhui
2020-09-02 3:46 ` Luben Tuikov
2020-09-02 4:43 ` Pan, Xinhui
2020-09-02 14:50 ` Luben Tuikov
2020-09-02 15:00 ` Daniel Stone
2020-09-02 15:16 ` Luben Tuikov
2020-09-02 15:51 ` Daniel Stone
2020-09-02 19:04 ` Luben Tuikov
2020-09-02 19:16 ` Alex Deucher
2020-09-02 19:55 ` Daniel Vetter
2020-09-02 19:59 ` Daniel Vetter
2020-09-03 1:57 ` Pan, Xinhui
2020-09-03 18:52 ` Luben Tuikov
2020-09-02 6:52 ` Daniel Vetter
2020-09-02 14:59 ` Luben Tuikov
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=20200902010645.26943-2-luben.tuikov@amd.com \
--to=luben.tuikov@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=Xinhui.Pan@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
/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