dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Wambui Karuga <wambui.karugax@gmail.com>
To: maarten.lankhorst@linux.intel.com, mripard@kernel.org,
	tzimmermann@suse.de, airlied@linux.ie, daniel@ffwll.ch
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: [RFC PATCH 2/3] drm/vc4: use new debugfs functions for file creation.
Date: Wed, 13 May 2020 14:41:28 +0300	[thread overview]
Message-ID: <20200513114130.28641-3-wambui.karugax@gmail.com> (raw)
In-Reply-To: <20200513114130.28641-1-wambui.karugax@gmail.com>

Currently, vc4 delays adding of debugfs files until drm_dev_register()
calls vc4_debugfs_init() on each registered minor.

This change removes this infrastructure and uses the new
drm_debugfs_add_file() function and drm_device->debugfs_list to track
debugfs files which are added at drm_dev_register() time on each minor.

Signed-off-by: Wambui Karuga <wambui.karugax@gmail.com>
---
 drivers/gpu/drm/vc4/vc4_bo.c      |  4 ++--
 drivers/gpu/drm/vc4/vc4_debugfs.c | 38 +++++++------------------------
 drivers/gpu/drm/vc4/vc4_hdmi.c    |  4 ++--
 drivers/gpu/drm/vc4/vc4_hvs.c     |  4 ++--
 drivers/gpu/drm/vc4/vc4_v3d.c     |  4 ++--
 5 files changed, 16 insertions(+), 38 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c
index 72d30d90b856..ff332bac25d1 100644
--- a/drivers/gpu/drm/vc4/vc4_bo.c
+++ b/drivers/gpu/drm/vc4/vc4_bo.c
@@ -65,8 +65,8 @@ static void vc4_bo_stats_print(struct drm_printer *p, struct vc4_dev *vc4)
 
 static int vc4_bo_stats_debugfs(struct seq_file *m, void *unused)
 {
-	struct drm_info_node *node = (struct drm_info_node *)m->private;
-	struct drm_device *dev = node->minor->dev;
+	struct drm_simple_info_entry *entry = m->private;
+	struct drm_device *dev = entry->dev;
 	struct vc4_dev *vc4 = to_vc4_dev(dev);
 	struct drm_printer p = drm_seq_file_printer(m);
 
diff --git a/drivers/gpu/drm/vc4/vc4_debugfs.c b/drivers/gpu/drm/vc4/vc4_debugfs.c
index 4fbbf980a299..e31e400c8cfc 100644
--- a/drivers/gpu/drm/vc4/vc4_debugfs.c
+++ b/drivers/gpu/drm/vc4/vc4_debugfs.c
@@ -11,10 +11,6 @@
 #include "vc4_drv.h"
 #include "vc4_regs.h"
 
-struct vc4_debugfs_info_entry {
-	struct list_head link;
-	struct drm_info_list info;
-};
 
 /**
  * Called at drm_dev_register() time on each of the minors registered
@@ -24,21 +20,15 @@ void
 vc4_debugfs_init(struct drm_minor *minor)
 {
 	struct vc4_dev *vc4 = to_vc4_dev(minor->dev);
-	struct vc4_debugfs_info_entry *entry;
 
 	debugfs_create_bool("hvs_load_tracker", S_IRUGO | S_IWUSR,
 			    minor->debugfs_root, &vc4->load_tracker_enabled);
-
-	list_for_each_entry(entry, &vc4->debugfs_list, link) {
-		drm_debugfs_create_files(&entry->info, 1,
-					 minor->debugfs_root, minor);
-	}
 }
 
 static int vc4_debugfs_regset32(struct seq_file *m, void *unused)
 {
-	struct drm_info_node *node = (struct drm_info_node *)m->private;
-	struct debugfs_regset32 *regset = node->info_ent->data;
+	struct drm_simple_info_entry *entry = m->private;
+	struct debugfs_regset32 *regset = entry->file.data;
 	struct drm_printer p = drm_seq_file_printer(m);
 
 	drm_print_regset32(&p, regset);
@@ -49,30 +39,18 @@ static int vc4_debugfs_regset32(struct seq_file *m, void *unused)
 /**
  * Registers a debugfs file with a callback function for a vc4 component.
  *
- * This is like drm_debugfs_create_files(), but that can only be
- * called a given DRM minor, while the various VC4 components want to
- * register their debugfs files during the component bind process.  We
- * track the request and delay it to be called on each minor during
- * vc4_debugfs_init().
+ * Various VC4 functions will register their debugfs files during the
+ * component bind process using drm_debugfs_add_file().
+ * These requests are tracked and delayed until their called on each
+ * minor during drm_dev_register().
+ *
  */
 void vc4_debugfs_add_file(struct drm_device *dev,
 			  const char *name,
 			  int (*show)(struct seq_file*, void*),
 			  void *data)
 {
-	struct vc4_dev *vc4 = to_vc4_dev(dev);
-
-	struct vc4_debugfs_info_entry *entry =
-		devm_kzalloc(dev->dev, sizeof(*entry), GFP_KERNEL);
-
-	if (!entry)
-		return;
-
-	entry->info.name = name;
-	entry->info.show = show;
-	entry->info.data = data;
-
-	list_add(&entry->link, &vc4->debugfs_list);
+	drm_debugfs_add_file(dev, name, show, data);
 }
 
 void vc4_debugfs_add_regset32(struct drm_device *drm,
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
index 625bfcf52dc4..05b2a3161148 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -182,8 +182,8 @@ static const struct debugfs_reg32 hd_regs[] = {
 
 static int vc4_hdmi_debugfs_regs(struct seq_file *m, void *unused)
 {
-	struct drm_info_node *node = (struct drm_info_node *)m->private;
-	struct drm_device *dev = node->minor->dev;
+	struct drm_simple_info_entry *entry = m->private;
+	struct drm_device *dev = entry->dev;
 	struct vc4_dev *vc4 = to_vc4_dev(dev);
 	struct vc4_hdmi *hdmi = vc4->hdmi;
 	struct drm_printer p = drm_seq_file_printer(m);
diff --git a/drivers/gpu/drm/vc4/vc4_hvs.c b/drivers/gpu/drm/vc4/vc4_hvs.c
index 5a43659da319..4c254c027649 100644
--- a/drivers/gpu/drm/vc4/vc4_hvs.c
+++ b/drivers/gpu/drm/vc4/vc4_hvs.c
@@ -82,8 +82,8 @@ void vc4_hvs_dump_state(struct drm_device *dev)
 
 static int vc4_hvs_debugfs_underrun(struct seq_file *m, void *data)
 {
-	struct drm_info_node *node = m->private;
-	struct drm_device *dev = node->minor->dev;
+	struct drm_simple_info_entry *entry = m->private;
+	struct drm_device *dev = entry->dev;
 	struct vc4_dev *vc4 = to_vc4_dev(dev);
 	struct drm_printer p = drm_seq_file_printer(m);
 
diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c
index cea77a21b205..cdef61666c42 100644
--- a/drivers/gpu/drm/vc4/vc4_v3d.c
+++ b/drivers/gpu/drm/vc4/vc4_v3d.c
@@ -98,8 +98,8 @@ static const struct debugfs_reg32 v3d_regs[] = {
 
 static int vc4_v3d_debugfs_ident(struct seq_file *m, void *unused)
 {
-	struct drm_info_node *node = (struct drm_info_node *)m->private;
-	struct drm_device *dev = node->minor->dev;
+	struct drm_simple_info_entry *entry = m->private;
+	struct drm_device *dev = entry->dev;
 	struct vc4_dev *vc4 = to_vc4_dev(dev);
 	int ret = vc4_v3d_pm_get(vc4);
 
-- 
2.26.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2020-05-15  6:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-13 11:41 [RFC PATCH 0/3] drm: introduce new method of creating debugfs files Wambui Karuga
2020-05-13 11:41 ` [RFC PATCH 1/3] drm/debugfs: create debugfs files during drm_dev_register() Wambui Karuga
2020-05-13 14:10   ` Thomas Zimmermann
2020-05-13 18:11     ` Wambui Karuga
2020-05-13 19:32       ` Daniel Vetter
2020-05-13 11:41 ` Wambui Karuga [this message]
2020-05-13 11:41 ` [RFC PATCH 3/3] drm: use new debugfs functions for various files Wambui Karuga

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=20200513114130.28641-3-wambui.karugax@gmail.com \
    --to=wambui.karugax@gmail.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=tzimmermann@suse.de \
    --subject='Re: [RFC PATCH 2/3] drm/vc4: use new debugfs functions for file creation.' \
    /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

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).