dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: swati.dhingra@intel.com
To: intel-gfx@lists.freedesktop.org
Cc: Swati Dhingra <swati.dhingra@intel.com>,
	dri-devel@lists.freedesktop.org,
	Sourab Gupta <sourab.gupta@intel.com>
Subject: [RFC 3/4] drm: Create driver specific root directory inside drmfs
Date: Mon,  5 Dec 2016 16:36:11 +0530	[thread overview]
Message-ID: <1480935972-6005-4-git-send-email-swati.dhingra@intel.com> (raw)
In-Reply-To: <1480935972-6005-1-git-send-email-swati.dhingra@intel.com>

From: Sourab Gupta <sourab.gupta@intel.com>

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 | 6 ++++++
 include/drm/drm_drv.h     | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 298013c..4c32cf8 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -671,6 +671,11 @@ EXPORT_SYMBOL(drm_dev_unref);
 int drm_dev_register(struct drm_device *dev, unsigned long flags)
 {
 	int ret;
+	struct dentry *drmfs_root;
+
+	drmfs_root = drmfs_create_dir(dev->driver->name, NULL);
+	if (!IS_ERR(drmfs_root))
+		dev->driver->drmfs_root = drmfs_root;
 
 	mutex_lock(&drm_global_mutex);
 
@@ -742,6 +747,7 @@ 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);
+	drmfs_remove(dev->driver->drmfs_root);
 }
 EXPORT_SYMBOL(drm_dev_unregister);
 
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index c4fc495..d646296 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -405,6 +405,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

  parent reply	other threads:[~2016-12-05 11:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-05 11:06 [RFC 0/4] Introduce drmfs pseudo filesystem for drm subsystem swati.dhingra
2016-12-05 11:06 ` [RFC 1/4] drm: Introduce drmfs pseudo filesystem interfaces swati.dhingra
2016-12-05 11:06 ` [RFC 2/4] drm: Register drmfs filesystem from drm init swati.dhingra
2016-12-05 11:06 ` swati.dhingra [this message]
2016-12-05 11:06 ` [RFC 4/4] drm/i915: Creating guc log file in drmfs instead of debugfs swati.dhingra
2016-12-12  6:14 ` [RFC 0/4] Introduce drmfs pseudo filesystem for drm subsystem sourab gupta
2016-12-12 15:33   ` Alex Deucher
2016-12-14  8:49     ` sourab gupta
  -- strict thread matches above, loose matches on Subject: below --
2016-12-19 10:42 swati.dhingra
2016-12-19 10:42 ` [RFC 3/4] drm: Create driver specific root directory inside drmfs swati.dhingra

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=1480935972-6005-4-git-send-email-swati.dhingra@intel.com \
    --to=swati.dhingra@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --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).