Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Aravind Iddamsetty <aravind.iddamsetty@linux.intel.com>
To: intel-xe@lists.freedesktop.org, thomas.hellstrom@linux.intel.com,
	rodrigo.vivi@intel.com, lucas.demarchi@intel.com
Cc: dri-devel@lists.freedesktop.org
Subject: [RFC 1/2] drm: add devm release action
Date: Wed, 20 Mar 2024 16:14:25 +0530	[thread overview]
Message-ID: <20240320104426.1592959-2-aravind.iddamsetty@linux.intel.com> (raw)
In-Reply-To: <20240320104426.1592959-1-aravind.iddamsetty@linux.intel.com>

In scenarios where drm_dev_put is directly called by driver we want to
release devm_drm_dev_init_release action associated with struct
drm_device.

Cc: Thomas Hellstr_m <thomas.hellstrom@linux.intel.com>

Signed-off-by: Aravind Iddamsetty <aravind.iddamsetty@linux.intel.com>
---
 drivers/gpu/drm/drm_drv.c | 6 ++++++
 include/drm/drm_drv.h     | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 243cacb3575c..b23c5081812b 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -714,6 +714,12 @@ static int devm_drm_dev_init(struct device *parent,
 					devm_drm_dev_init_release, dev);
 }
 
+void __devm_drm_dev_release_action(struct drm_device *dev)
+{
+	devm_release_action(dev->dev, devm_drm_dev_init_release, dev);
+}
+EXPORT_SYMBOL(__devm_drm_dev_release_action);
+
 void *__devm_drm_dev_alloc(struct device *parent,
 			   const struct drm_driver *driver,
 			   size_t size, size_t offset)
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index 8878260d7529..a1d12cb72088 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -444,6 +444,8 @@ struct drm_driver {
 	const struct file_operations *fops;
 };
 
+void __devm_drm_dev_release_action(struct drm_device *dev);
+
 void *__devm_drm_dev_alloc(struct device *parent,
 			   const struct drm_driver *driver,
 			   size_t size, size_t offset);
@@ -477,6 +479,8 @@ void *__devm_drm_dev_alloc(struct device *parent,
 #define devm_drm_dev_alloc(parent, driver, type, member) \
 	((type *) __devm_drm_dev_alloc(parent, driver, sizeof(type), \
 				       offsetof(type, member)))
+#define devm_drm_release_action(drm_dev) \
+	__devm_drm_dev_release_action(drm_dev)
 
 struct drm_device *drm_dev_alloc(const struct drm_driver *driver,
 				 struct device *parent);
-- 
2.25.1


  reply	other threads:[~2024-03-20 10:41 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-20 10:44 [RFC 0/2] drm/xe: Support PCIe FLR Aravind Iddamsetty
2024-03-20 10:44 ` Aravind Iddamsetty [this message]
2024-03-20 20:53   ` [RFC 1/2] drm: add devm release action Rodrigo Vivi
2024-03-21  6:08     ` Aravind Iddamsetty
2024-03-21  6:47       ` Jani Nikula
2024-03-21  7:21         ` Aravind Iddamsetty
2024-03-20 10:44 ` [RFC 2/2] drm/xe/FLR: Support PCIe FLR Aravind Iddamsetty
2024-03-20 20:52   ` Rodrigo Vivi
2024-03-21 10:45     ` Aravind Iddamsetty
2024-03-20 23:01   ` Lucas De Marchi
2024-03-21 11:38     ` Aravind Iddamsetty
2024-03-20 11:10 ` ✓ CI.Patch_applied: success for drm/xe: " Patchwork
2024-03-20 11:10 ` ✗ CI.checkpatch: warning " Patchwork
2024-03-20 11:11 ` ✓ CI.KUnit: success " Patchwork
2024-03-20 11:22 ` ✓ CI.Build: " Patchwork
2024-03-20 11:24 ` ✓ CI.Hooks: " Patchwork
2024-03-20 11:26 ` ✗ CI.checksparse: warning " Patchwork
2024-03-20 11:52 ` ✓ CI.BAT: success " Patchwork
2024-03-20 22:25 ` [RFC 0/2] " Lucas De Marchi

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=20240320104426.1592959-2-aravind.iddamsetty@linux.intel.com \
    --to=aravind.iddamsetty@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=thomas.hellstrom@linux.intel.com \
    /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