From: swati.dhingra@intel.com
To: intel-gfx@lists.freedesktop.org
Cc: Sourab Gupta <sourab.gupta@intel.com>,
Swati Dhingra <swati.dhingra@intel.com>
Subject: [RFC 2/3] drm: Register drmfs filesystem from drm init
Date: Thu, 1 Dec 2016 13:44:16 +0530 [thread overview]
Message-ID: <1480580057-27548-3-git-send-email-swati.dhingra@intel.com> (raw)
In-Reply-To: <1480580057-27548-1-git-send-email-swati.dhingra@intel.com>
From: Swati Dhingra <swati.dhingra@intel.com>
During drm module initialization, drm_core_init initializes the drmfs
filesystem and register this with kernel. A driver specific directory is created
inside drmfs root, and dentry of this directory is saved for subsequent use
by the driver (e.g. i915). The driver can then create files/directories inside
this root directory directly.
In case of i915 driver, the top directory is created at '/sys/kernel/drm/i915'.
Signed-off-by: Sourab Gupta <sourab.gupta@intel.com>
Signed-off-by: Swati Dhingra <swati.dhingra@intel.com>
---
drivers/gpu/drm/drm_drv.c | 22 ++++++++++++++++++++++
include/drm/drm_drv.h | 3 +++
2 files changed, 25 insertions(+)
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 84fcfcb..ead360bd 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -688,6 +688,14 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)
{
int ret;
+#ifdef CONFIG_DRMFS
+ dev->driver->drmfs_root = drmfs_create_dir(dev->driver->name, NULL);
+ if (IS_ERR(dev->driver->drmfs_root)) {
+ DRM_ERROR("Failed to get drmfs root dentry\n");
+ return PTR_ERR(dev->driver->drmfs_root);
+ }
+#endif
+
mutex_lock(&drm_global_mutex);
ret = drm_minor_register(dev, DRM_MINOR_CONTROL);
@@ -758,6 +766,9 @@ void drm_dev_unregister(struct drm_device *dev)
drm_minor_unregister(dev, DRM_MINOR_PRIMARY);
drm_minor_unregister(dev, DRM_MINOR_RENDER);
drm_minor_unregister(dev, DRM_MINOR_CONTROL);
+#ifdef CONFIG_DRMFS
+ drmfs_remove(dev->driver->drmfs_root);
+#endif
}
EXPORT_SYMBOL(drm_dev_unregister);
@@ -825,6 +836,9 @@ static void drm_core_exit(void)
{
unregister_chrdev(DRM_MAJOR, "drm");
debugfs_remove(drm_debugfs_root);
+#ifdef CONFIG_DRMFS
+ drmfs_fini();
+#endif
drm_sysfs_destroy();
idr_destroy(&drm_minors_idr);
drm_connector_ida_destroy();
@@ -845,6 +859,14 @@ static int __init drm_core_init(void)
goto error;
}
+#ifdef CONFIG_DRMFS
+ ret = drmfs_init();
+ if (ret < 0) {
+ DRM_ERROR("Cannot create DRM FS: %d\n", ret);
+ goto error;
+ }
+#endif
+
drm_debugfs_root = debugfs_create_dir("dri", NULL);
if (!drm_debugfs_root) {
ret = -ENOMEM;
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index aad8bba..34804de 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -403,6 +403,9 @@ struct drm_driver {
/* List of devices hanging off this driver with stealth attach. */
struct list_head legacy_dev_list;
+
+ /* drmfs parent directory dentry for this driver */
+ struct dentry *drmfs_root;
};
extern __printf(6, 7)
--
2.7.4
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-12-01 8:05 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-01 8:14 [RFC 0/3] Introduce drmfs pseudo filesystem for drm subsystem swati.dhingra
2016-12-01 8:14 ` [RFC 1/3] fs: Introduce drmfs pseudo filesystem interfaces swati.dhingra
2016-12-02 7:53 ` Daniel Vetter
2016-12-02 8:27 ` sourab gupta
2016-12-02 22:40 ` Matt Roper
2016-12-03 0:53 ` sourab gupta
2016-12-03 9:25 ` Chris Wilson
2016-12-01 8:14 ` swati.dhingra [this message]
2016-12-02 7:57 ` [RFC 2/3] drm: Register drmfs filesystem from drm init Daniel Vetter
2016-12-02 8:32 ` sourab gupta
2016-12-01 8:14 ` [RFC 3/3] drm/i915: Creating guc log file in drmfs instead of debugfs swati.dhingra
2016-12-01 8:45 ` ✓ Fi.CI.BAT: success for Introduce drmfs pseudo filesystem for drm subsystem (rev2) Patchwork
2016-12-02 7:52 ` [RFC 0/3] Introduce drmfs pseudo filesystem for drm subsystem Daniel Vetter
-- strict thread matches above, loose matches on Subject: below --
2016-12-01 7:02 swati.dhingra
2016-12-01 7:02 ` [RFC 2/3] drm: Register drmfs filesystem from drm init swati.dhingra
2016-12-01 8:15 ` Chris Wilson
2016-12-01 8:41 ` sourab gupta
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=1480580057-27548-3-git-send-email-swati.dhingra@intel.com \
--to=swati.dhingra@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=sourab.gupta@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;
as well as URLs for NNTP newsgroup(s).