diff mbox

[5/6] drm/i915: Move forcewake debugfs setup also

Message ID 1390336402-2049-5-git-send-email-benjamin.widawsky@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ben Widawsky Jan. 21, 2014, 8:33 p.m. UTC
The forcewake setup is eerily similar, except it needs special mode
flags. Inserting that info into our structure is trivial, and with that
forcewake easily converts to using the new interface as well.

Notice that CRC is lacking from this patch (CRC being very similar to
forcewake in code). CRC is targeted for a new file, so there is no
reason to move it.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 48 +++++++++++--------------------------
 1 file changed, 14 insertions(+), 34 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 72b8388..d092631 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -3206,21 +3206,6 @@  static const struct file_operations i915_forcewake_fops = {
 	.release = i915_forcewake_release,
 };
 
-static int i915_forcewake_create(struct dentry *root, struct drm_minor *minor)
-{
-	struct drm_device *dev = minor->dev;
-	struct dentry *ent;
-
-	ent = debugfs_create_file("i915_forcewake_user",
-				  S_IRUSR,
-				  root, dev,
-				  &i915_forcewake_fops);
-	if (!ent)
-		return -ENOMEM;
-
-	return drm_add_fake_info_node(minor, ent, &i915_forcewake_fops);
-}
-
 static const struct drm_info_list i915_debugfs_list[] = {
 	{"i915_capabilities", i915_capabilities, 0},
 	{"i915_gem_objects", i915_gem_object_info, 0},
@@ -3267,18 +3252,20 @@  static const struct drm_info_list i915_debugfs_list[] = {
 static const struct i915_debugfs_files {
 	const char *name;
 	const struct file_operations *fops;
+	umode_t mode;
 } i915_debugfs_files[] = {
-	{"i915_wedged", &i915_wedged_fops},
-	{"i915_max_freq", &i915_max_freq_fops},
-	{"i915_min_freq", &i915_min_freq_fops},
-	{"i915_cache_sharing", &i915_cache_sharing_fops},
-	{"i915_ring_stop", &i915_ring_stop_fops},
-	{"i915_ring_missed_irq", &i915_ring_missed_irq_fops},
-	{"i915_ring_test_irq", &i915_ring_test_irq_fops},
-	{"i915_gem_drop_caches", &i915_drop_caches_fops},
-	{"i915_error_state", &i915_error_state_fops},
-	{"i915_next_seqno", &i915_next_seqno_fops},
-	{"i915_display_crc_ctl", &i915_display_crc_ctl_fops},
+	{"i915_wedged", &i915_wedged_fops, S_IRUGO | S_IWUSR},
+	{"i915_max_freq", &i915_max_freq_fops, S_IRUGO | S_IWUSR},
+	{"i915_min_freq", &i915_min_freq_fops, S_IRUGO | S_IWUSR},
+	{"i915_cache_sharing", &i915_cache_sharing_fops, S_IRUGO | S_IWUSR},
+	{"i915_ring_stop", &i915_ring_stop_fops, S_IRUGO | S_IWUSR},
+	{"i915_ring_missed_irq", &i915_ring_missed_irq_fops, S_IRUGO | S_IWUSR},
+	{"i915_ring_test_irq", &i915_ring_test_irq_fops, S_IRUGO | S_IWUSR},
+	{"i915_gem_drop_caches", &i915_drop_caches_fops, S_IRUGO | S_IWUSR},
+	{"i915_error_state", &i915_error_state_fops, S_IRUGO | S_IWUSR},
+	{"i915_next_seqno", &i915_next_seqno_fops, S_IRUGO | S_IWUSR},
+	{"i915_display_crc_ctl", &i915_display_crc_ctl_fops, S_IRUGO | S_IWUSR},
+	{"i915_forcewake_user", &i915_forcewake_fops, S_IRUGO},
 };
 
 void intel_display_crc_init(struct drm_device *dev)
@@ -3299,10 +3286,6 @@  int i915_debugfs_init(struct drm_minor *minor)
 {
 	int ret, i;
 
-	ret = i915_forcewake_create(minor->debugfs_root, minor);
-	if (ret)
-		return ret;
-
 	for (i = 0; i < ARRAY_SIZE(i915_pipe_crc_data); i++) {
 		ret = i915_pipe_crc_create(minor->debugfs_root, minor, i);
 		if (ret)
@@ -3313,7 +3296,7 @@  int i915_debugfs_init(struct drm_minor *minor)
 		ret = drm_debugfs_create_file(minor->debugfs_root, minor,
 					      i915_debugfs_files[i].name,
 					      i915_debugfs_files[i].fops,
-					      S_IRUGO | S_IWUSR);
+					      i915_debugfs_files[i].mode);
 		if (ret)
 			return ret;
 	}
@@ -3330,9 +3313,6 @@  void i915_debugfs_cleanup(struct drm_minor *minor)
 	drm_debugfs_remove_files(i915_debugfs_list,
 				 I915_DEBUGFS_ENTRIES, minor);
 
-	drm_debugfs_remove_files((struct drm_info_list *) &i915_forcewake_fops,
-				 1, minor);
-
 	for (i = 0; i < ARRAY_SIZE(i915_pipe_crc_data); i++) {
 		struct drm_info_list *info_list =
 			(struct drm_info_list *)&i915_pipe_crc_data[i];