Skip to contentSkip to conversation

drm: debugfs: make drm_debugfs_remove_files() a void function

PATCH Applied Greg Kroah-Hartman 2 participants 9 messages Jun 14, 2019 – Jun 18, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm: debugfs: make drm_debugfs_remove_files() a void function

The function can not fail, and no one checks the current return value, so just mark it as a void function so no one gets confused.

Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Sean Paul <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/drm_debugfs.c | 5 ++---
 include/drm/drm_debugfs.h     | 9 ++++-----
 2 files changed, 6 insertions(+), 8 deletions(-)
drivers/gpu/drm/drm_debugfs.c +2 -3
index 6f2802e9bfb5..515569002c86 100644
@@ -270,8 +270,8 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id,
 }
 
 
-int drm_debugfs_remove_files(const struct drm_info_list *files, int count,
-			     struct drm_minor *minor)
+void drm_debugfs_remove_files(const struct drm_info_list *files, int count,
+			      struct drm_minor *minor)
 {
 	struct list_head *pos, *q;
 	struct drm_info_node *tmp;
@@ -289,7 +289,6 @@ int drm_debugfs_remove_files(const struct drm_info_list *files, int count,
 		}
 	}
 	mutex_unlock(&minor->debugfs_lock);
-	return 0;
 }
 EXPORT_SYMBOL(drm_debugfs_remove_files);
 
include/drm/drm_debugfs.h +4 -5
index ac0f75df1ac9..422d0d201c0a 100644
@@ -81,8 +81,8 @@ struct drm_info_node {
 int drm_debugfs_create_files(const struct drm_info_list *files,
 			     int count, struct dentry *root,
 			     struct drm_minor *minor);
-int drm_debugfs_remove_files(const struct drm_info_list *files,
-			     int count, struct drm_minor *minor);
+void drm_debugfs_remove_files(const struct drm_info_list *files,
+			      int count, struct drm_minor *minor);
 #else
 static inline int drm_debugfs_create_files(const struct drm_info_list *files,
 					   int count, struct dentry *root,
@@ -91,10 +91,9 @@ static inline int drm_debugfs_create_files(const struct drm_info_list *files,
 	return 0;
 }
 
-static inline int drm_debugfs_remove_files(const struct drm_info_list *files,
-					   int count, struct drm_minor *minor)
+static inline void drm_debugfs_remove_files(const struct drm_info_list *files,
+					    int count, struct drm_minor *minor)
 {
-	return 0;
 }
 #endif
 
Signature · 6 lines
2.22.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

PATCH 2/2 drm: debugfs: make drm_debugfs_create_files() never fail

As stated before, there is no need to care if a debugfs function succeeds or not, and no code logic in the kernel should ever change based on a debugfs function return value, so make drm_debugfs_create_files() never fail. If it encounters an odd/rare/impossible error (i.e. out of memory, or a duplicate debugfs filename to be created), just keep on moving as if nothing improper had happened.

Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Sean Paul <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/drm_debugfs.c | 26 ++++++--------------------
 1 file changed, 6 insertions(+), 20 deletions(-)
drivers/gpu/drm/drm_debugfs.c +6 -20
index 515569002c86..009e1c0ac7b4 100644
@@ -173,9 +173,8 @@ int drm_debugfs_create_files(const struct drm_info_list *files, int count,
 			     struct dentry *root, struct drm_minor *minor)
 {
 	struct drm_device *dev = minor->dev;
-	struct dentry *ent;
 	struct drm_info_node *tmp;
-	int i, ret;
+	int i;
 
 	for (i = 0; i < count; i++) {
 		u32 features = files[i].driver_features;
@@ -185,22 +184,13 @@ int drm_debugfs_create_files(const struct drm_info_list *files, int count,
 			continue;
 
 		tmp = kmalloc(sizeof(struct drm_info_node), GFP_KERNEL);
-		if (tmp == NULL) {
-			ret = -1;
-			goto fail;
-		}
-		ent = debugfs_create_file(files[i].name, S_IFREG | S_IRUGO,
-					  root, tmp, &drm_debugfs_fops);
-		if (!ent) {
-			DRM_ERROR("Cannot create /sys/kernel/debug/dri/%pd/%s\n",
-				  root, files[i].name);
-			kfree(tmp);
-			ret = -1;
-			goto fail;
-		}
+		if (tmp == NULL)
+			continue;
 
 		tmp->minor = minor;
-		tmp->dent = ent;
+		tmp->dent = debugfs_create_file(files[i].name,
+						S_IFREG | S_IRUGO, root, tmp,
+						&drm_debugfs_fops);
 		tmp->info_ent = &files[i];
 
 		mutex_lock(&minor->debugfs_lock);
@@ -208,10 +198,6 @@ int drm_debugfs_create_files(const struct drm_info_list *files, int count,
 		mutex_unlock(&minor->debugfs_lock);
 	}
 	return 0;
-
-fail:
-	drm_debugfs_remove_files(files, count, minor);
-	return ret;
 }
 EXPORT_SYMBOL(drm_debugfs_create_files);
 
Signature · 6 lines
2.22.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

Re: [PATCH 2/2] drm: debugfs: make drm_debugfs_create_files() never fail

Quoted 8 lines · Greg Kroah-Hartman

As stated before, there is no need to care if a debugfs function succeeds or not, and no code logic in the kernel should ever change based on a debugfs function return value, so make drm_debugfs_create_files() never fail. If it encounters an odd/rare/impossible error (i.e. out of memory, or a duplicate debugfs filename to be created), just keep on moving as if nothing improper had happened.

Quoted 7 lines
Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Sean Paul <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>

Applied this one to drm-misc-next, thanks.
-Daniel

Quoted 61 lines
---
 drivers/gpu/drm/drm_debugfs.c | 26 ++++++--------------------
 1 file changed, 6 insertions(+), 20 deletions(-)
drivers/gpu/drm/drm_debugfs.c +6 -20
index 515569002c86..009e1c0ac7b4 100644
@@ -173,9 +173,8 @@ int drm_debugfs_create_files(const struct drm_info_list *files, int count,
 			     struct dentry *root, struct drm_minor *minor)
 {
 	struct drm_device *dev = minor->dev;
-	struct dentry *ent;
 	struct drm_info_node *tmp;
-	int i, ret;
+	int i;
 
 	for (i = 0; i < count; i++) {
 		u32 features = files[i].driver_features;
@@ -185,22 +184,13 @@ int drm_debugfs_create_files(const struct drm_info_list *files, int count,
 			continue;
 
 		tmp = kmalloc(sizeof(struct drm_info_node), GFP_KERNEL);
-		if (tmp == NULL) {
-			ret = -1;
-			goto fail;
-		}
-		ent = debugfs_create_file(files[i].name, S_IFREG | S_IRUGO,
-					  root, tmp, &drm_debugfs_fops);
-		if (!ent) {
-			DRM_ERROR("Cannot create /sys/kernel/debug/dri/%pd/%s\n",
-				  root, files[i].name);
-			kfree(tmp);
-			ret = -1;
-			goto fail;
-		}
+		if (tmp == NULL)
+			continue;
 
 		tmp->minor = minor;
-		tmp->dent = ent;
+		tmp->dent = debugfs_create_file(files[i].name,
+						S_IFREG | S_IRUGO, root, tmp,
+						&drm_debugfs_fops);
 		tmp->info_ent = &files[i];
 
 		mutex_lock(&minor->debugfs_lock);
@@ -208,10 +198,6 @@ int drm_debugfs_create_files(const struct drm_info_list *files, int count,
 		mutex_unlock(&minor->debugfs_lock);
 	}
 	return 0;
-
-fail:
-	drm_debugfs_remove_files(files, count, minor);
-	return ret;
 }
 EXPORT_SYMBOL(drm_debugfs_create_files);
 
Signature · 1 line
2.22.0
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw
In reply to Greg Kroah-Hartman
Quoted 20 lines · Greg Kroah-Hartman

The function can not fail, and no one checks the current return value, so just mark it as a void function so no one gets confused.

Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Sean Paul <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/drm_debugfs.c | 5 ++---
 include/drm/drm_debugfs.h     | 9 ++++-----
 2 files changed, 6 insertions(+), 8 deletions(-)
drivers/gpu/drm/drm_debugfs.c +0 -0
index 6f2802e9bfb5..515569002c86 100644

drivers/gpu/drm/drm_debugfs.c int drm_debugfs_init(struct drm_minor *minor, int minor_id, · line 274

Quoted 7 lines
drivers/gpu/drm/drm_debugfs.c +2 -2
@@ -270,8 +270,8 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id,
 }
 
 
-int drm_debugfs_remove_files(const struct drm_info_list *files, int count,
-			     struct drm_minor *minor)
+void drm_debugfs_remove_files(const struct drm_info_list *files, int count,
+			      struct drm_minor *minor)

We're trying to entirely nuke this function here, see the kerneldoc for drm_debugfs_create_files(). Only user left is tegra, and we call the "remove all debugfs files" and the ->early_unregister hooks all from the same place. So this can all be garbage collected. It's mildly annoying because we'd need to move the kfree from ->early_unregister into ->destroy callbacks, because connectors are unregister before we throw away all the debugfs files in drm_dev_unregister(). But imo that's cleaner anway.

Up for that?

Cheers, Daniel

Quoted 42 lines
drivers/gpu/drm/drm_debugfs.c +0 -1
 {
 	struct list_head *pos, *q;
 	struct drm_info_node *tmp;
@@ -289,7 +289,6 @@ int drm_debugfs_remove_files(const struct drm_info_list *files, int count,
 		}
 	}
 	mutex_unlock(&minor->debugfs_lock);
-	return 0;
 }
 EXPORT_SYMBOL(drm_debugfs_remove_files);
 
include/drm/drm_debugfs.h +4 -5
index ac0f75df1ac9..422d0d201c0a 100644
@@ -81,8 +81,8 @@ struct drm_info_node {
 int drm_debugfs_create_files(const struct drm_info_list *files,
 			     int count, struct dentry *root,
 			     struct drm_minor *minor);
-int drm_debugfs_remove_files(const struct drm_info_list *files,
-			     int count, struct drm_minor *minor);
+void drm_debugfs_remove_files(const struct drm_info_list *files,
+			      int count, struct drm_minor *minor);
 #else
 static inline int drm_debugfs_create_files(const struct drm_info_list *files,
 					   int count, struct dentry *root,
@@ -91,10 +91,9 @@ static inline int drm_debugfs_create_files(const struct drm_info_list *files,
 	return 0;
 }
 
-static inline int drm_debugfs_remove_files(const struct drm_info_list *files,
-					   int count, struct drm_minor *minor)
+static inline void drm_debugfs_remove_files(const struct drm_info_list *files,
+					    int count, struct drm_minor *minor)
 {
-	return 0;
 }
 #endif
 
Signature · 1 line
2.22.0
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw
Quoted 24 lines · Daniel Vetter
Quoted 23 lines · Greg Kroah-Hartman

The function can not fail, and no one checks the current return value, so just mark it as a void function so no one gets confused.

Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Sean Paul <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/drm_debugfs.c | 5 ++---
 include/drm/drm_debugfs.h     | 9 ++++-----
 2 files changed, 6 insertions(+), 8 deletions(-)
drivers/gpu/drm/drm_debugfs.c +0 -0
index 6f2802e9bfb5..515569002c86 100644
@@ -270,8 +270,8 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id,
 }
 
 
Quoted 12 lines

drivers/gpu/drm/drm_debugfs.c int drm_debugfs_init(struct drm_minor *minor, int minor_id, · line 274

Quoted 4 lines
drivers/gpu/drm/drm_debugfs.c +2 -2
-int drm_debugfs_remove_files(const struct drm_info_list *files, int count,
-			     struct drm_minor *minor)
+void drm_debugfs_remove_files(const struct drm_info_list *files, int count,
+			      struct drm_minor *minor)

We're trying to entirely nuke this function here, see the kerneldoc for drm_debugfs_create_files(). Only user left is tegra, and we call the "remove all debugfs files" and the ->early_unregister hooks all from the same place. So this can all be garbage collected. It's mildly annoying because we'd need to move the kfree from ->early_unregister into ->destroy callbacks, because connectors are unregister before we throw away all the debugfs files in drm_dev_unregister(). But imo that's cleaner anway.

I would love to see this function gone, it can also make things a lot simpler from the point of view of creating the debugfs files as well, as no dentries will need to be saved.

Quoted 1 line

Up for that?

Sure, I can do that. I have a much larger patch messing with drm_debugfs_create_files() that I want you all to be in a good mood for when I submit it (it touches all drivers at once), so I might as well clean this up first :)

Give me a week, I'm supposed to be writing my slides for a conference now, instead I'm procrastinating by writing debugfs cleanup patches, I need to stop...

thanks,

greg k-h
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw
Quoted 43 lines · Greg Kroah-Hartman
Quoted 24 lines · Daniel Vetter
Quoted 23 lines · Greg Kroah-Hartman

The function can not fail, and no one checks the current return value, so just mark it as a void function so no one gets confused.

Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Sean Paul <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/drm_debugfs.c | 5 ++---
 include/drm/drm_debugfs.h     | 9 ++++-----
 2 files changed, 6 insertions(+), 8 deletions(-)
drivers/gpu/drm/drm_debugfs.c +0 -0
index 6f2802e9bfb5..515569002c86 100644
@@ -270,8 +270,8 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id,
 }
 
 
Quoted 12 lines

drivers/gpu/drm/drm_debugfs.c int drm_debugfs_init(struct drm_minor *minor, int minor_id, · line 274

Quoted 4 lines
drivers/gpu/drm/drm_debugfs.c +2 -2
-int drm_debugfs_remove_files(const struct drm_info_list *files, int count,
-                        struct drm_minor *minor)
+void drm_debugfs_remove_files(const struct drm_info_list *files, int count,
+                         struct drm_minor *minor)

We're trying to entirely nuke this function here, see the kerneldoc for drm_debugfs_create_files(). Only user left is tegra, and we call the "remove all debugfs files" and the ->early_unregister hooks all from the same place. So this can all be garbage collected. It's mildly annoying because we'd need to move the kfree from ->early_unregister into ->destroy callbacks, because connectors are unregister before we throw away all the debugfs files in drm_dev_unregister(). But imo that's cleaner anway.

I would love to see this function gone, it can also make things a lot simpler from the point of view of creating the debugfs files as well, as no dentries will need to be saved.

Quoted 6 lines
Quoted 1 line

Up for that?

Sure, I can do that. I have a much larger patch messing with drm_debugfs_create_files() that I want you all to be in a good mood for when I submit it (it touches all drivers at once), so I might as well clean this up first :)

Oh don't worry, we've had a pile of cleanup todo tasks in this area since a long time. You doing them all is going to make me a happy camper :-)

Only thing to be aware of is that we have a bit a habit of dragging good contributors of refactoring/cleanup/fundamental work like this into the drm fold for good. You might get stuck ...

Quoted 3 lines

Give me a week, I'm supposed to be writing my slides for a conference now, instead I'm procrastinating by writing debugfs cleanup patches, I need to stop...

:-)

Cheers, Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#6 lore raw
Quoted 52 lines · Daniel Vetter
Quoted 43 lines · Greg Kroah-Hartman
Quoted 24 lines · Daniel Vetter
Quoted 23 lines · Greg Kroah-Hartman

The function can not fail, and no one checks the current return value, so just mark it as a void function so no one gets confused.

Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Sean Paul <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/drm_debugfs.c | 5 ++---
 include/drm/drm_debugfs.h     | 9 ++++-----
 2 files changed, 6 insertions(+), 8 deletions(-)
drivers/gpu/drm/drm_debugfs.c +0 -0
index 6f2802e9bfb5..515569002c86 100644
@@ -270,8 +270,8 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id,
 }
 
 
Quoted 12 lines

drivers/gpu/drm/drm_debugfs.c int drm_debugfs_init(struct drm_minor *minor, int minor_id, · line 274

Quoted 4 lines
drivers/gpu/drm/drm_debugfs.c +2 -2
-int drm_debugfs_remove_files(const struct drm_info_list *files, int count,
-                        struct drm_minor *minor)
+void drm_debugfs_remove_files(const struct drm_info_list *files, int count,
+                         struct drm_minor *minor)

We're trying to entirely nuke this function here, see the kerneldoc for drm_debugfs_create_files(). Only user left is tegra, and we call the "remove all debugfs files" and the ->early_unregister hooks all from the same place. So this can all be garbage collected. It's mildly annoying because we'd need to move the kfree from ->early_unregister into ->destroy callbacks, because connectors are unregister before we throw away all the debugfs files in drm_dev_unregister(). But imo that's cleaner anway.

I would love to see this function gone, it can also make things a lot simpler from the point of view of creating the debugfs files as well, as no dentries will need to be saved.

Quoted 6 lines
Quoted 1 line

Up for that?

Sure, I can do that. I have a much larger patch messing with drm_debugfs_create_files() that I want you all to be in a good mood for when I submit it (it touches all drivers at once), so I might as well clean this up first :)

Quoted 7 lines

Oh don't worry, we've had a pile of cleanup todo tasks in this area since a long time. You doing them all is going to make me a happy camper :-)

Only thing to be aware of is that we have a bit a habit of dragging good contributors of refactoring/cleanup/fundamental work like this into the drm fold for good. You might get stuck ...

Hah...

Anyway, what tree/branch should I do this work on? I see drm-next, is that the one to use, but it doesn't seem to have the other patches you all said you accepted from me for this debugfs cleanup already.

thanks,

greg k-h
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#7 lore raw
Quoted 61 lines · Greg Kroah-Hartman
Quoted 52 lines · Daniel Vetter
Quoted 43 lines · Greg Kroah-Hartman
Quoted 24 lines · Daniel Vetter
Quoted 23 lines · Greg Kroah-Hartman

The function can not fail, and no one checks the current return value, so just mark it as a void function so no one gets confused.

Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Sean Paul <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/drm_debugfs.c | 5 ++---
 include/drm/drm_debugfs.h     | 9 ++++-----
 2 files changed, 6 insertions(+), 8 deletions(-)
drivers/gpu/drm/drm_debugfs.c +0 -0
index 6f2802e9bfb5..515569002c86 100644
@@ -270,8 +270,8 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id,
 }
 
 
Quoted 12 lines

drivers/gpu/drm/drm_debugfs.c int drm_debugfs_init(struct drm_minor *minor, int minor_id, · line 274

Quoted 4 lines
drivers/gpu/drm/drm_debugfs.c +2 -2
-int drm_debugfs_remove_files(const struct drm_info_list *files, int count,
-                        struct drm_minor *minor)
+void drm_debugfs_remove_files(const struct drm_info_list *files, int count,
+                         struct drm_minor *minor)

We're trying to entirely nuke this function here, see the kerneldoc for drm_debugfs_create_files(). Only user left is tegra, and we call the "remove all debugfs files" and the ->early_unregister hooks all from the same place. So this can all be garbage collected. It's mildly annoying because we'd need to move the kfree from ->early_unregister into ->destroy callbacks, because connectors are unregister before we throw away all the debugfs files in drm_dev_unregister(). But imo that's cleaner anway.

I would love to see this function gone, it can also make things a lot simpler from the point of view of creating the debugfs files as well, as no dentries will need to be saved.

Quoted 6 lines
Quoted 1 line

Up for that?

Sure, I can do that. I have a much larger patch messing with drm_debugfs_create_files() that I want you all to be in a good mood for when I submit it (it touches all drivers at once), so I might as well clean this up first :)

Quoted 7 lines

Oh don't worry, we've had a pile of cleanup todo tasks in this area since a long time. You doing them all is going to make me a happy camper :-)

Only thing to be aware of is that we have a bit a habit of dragging good contributors of refactoring/cleanup/fundamental work like this into the drm fold for good. You might get stuck ...

Quoted 5 lines

Hah...

Anyway, what tree/branch should I do this work on? I see drm-next, is that the one to use, but it doesn't seem to have the other patches you all said you accepted from me for this debugfs cleanup already.

linux-next is usually a good starting point, drm stuff is a bit too much spread around multiple trees. The only caveat is that some trees (drm-misc and drm-intel) keep merging during the feature freeze (after -rc6) and merge window, to collect patches for the merge-window+1. In those cases it might be better to rebase on top of drm-tip:

https://cgit.freedesktop.org/drm-tip

It's kinda like linux-next, but for drm. Only downside is that not all drm trees participate in that integration tree.

Simpelst is probably to just base on linux-next and dump everything that hasn't landed after -rc2 onto dri-devel again.

Cheers, Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#8 lore raw
Quoted 74 lines · Daniel Vetter
Quoted 61 lines · Greg Kroah-Hartman
Quoted 52 lines · Daniel Vetter
Quoted 43 lines · Greg Kroah-Hartman
Quoted 24 lines · Daniel Vetter
Quoted 23 lines · Greg Kroah-Hartman

The function can not fail, and no one checks the current return value, so just mark it as a void function so no one gets confused.

Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Sean Paul <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/drm_debugfs.c | 5 ++---
 include/drm/drm_debugfs.h     | 9 ++++-----
 2 files changed, 6 insertions(+), 8 deletions(-)
drivers/gpu/drm/drm_debugfs.c +0 -0
index 6f2802e9bfb5..515569002c86 100644
@@ -270,8 +270,8 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id,
 }
 
 
Quoted 12 lines

drivers/gpu/drm/drm_debugfs.c int drm_debugfs_init(struct drm_minor *minor, int minor_id, · line 274

Quoted 4 lines
drivers/gpu/drm/drm_debugfs.c +2 -2
-int drm_debugfs_remove_files(const struct drm_info_list *files, int count,
-                        struct drm_minor *minor)
+void drm_debugfs_remove_files(const struct drm_info_list *files, int count,
+                         struct drm_minor *minor)

We're trying to entirely nuke this function here, see the kerneldoc for drm_debugfs_create_files(). Only user left is tegra, and we call the "remove all debugfs files" and the ->early_unregister hooks all from the same place. So this can all be garbage collected. It's mildly annoying because we'd need to move the kfree from ->early_unregister into ->destroy callbacks, because connectors are unregister before we throw away all the debugfs files in drm_dev_unregister(). But imo that's cleaner anway.

I would love to see this function gone, it can also make things a lot simpler from the point of view of creating the debugfs files as well, as no dentries will need to be saved.

Quoted 6 lines
Quoted 1 line

Up for that?

Sure, I can do that. I have a much larger patch messing with drm_debugfs_create_files() that I want you all to be in a good mood for when I submit it (it touches all drivers at once), so I might as well clean this up first :)

Quoted 7 lines

Oh don't worry, we've had a pile of cleanup todo tasks in this area since a long time. You doing them all is going to make me a happy camper :-)

Only thing to be aware of is that we have a bit a habit of dragging good contributors of refactoring/cleanup/fundamental work like this into the drm fold for good. You might get stuck ...

Quoted 5 lines

Hah...

Anyway, what tree/branch should I do this work on? I see drm-next, is that the one to use, but it doesn't seem to have the other patches you all said you accepted from me for this debugfs cleanup already.

linux-next is usually a good starting point, drm stuff is a bit too much spread around multiple trees. The only caveat is that some trees (drm-misc and drm-intel) keep merging during the feature freeze (after -rc6) and merge window, to collect patches for the merge-window+1. In those cases it might be better to rebase on top of drm-tip:

Quoted 7 lines

https://cgit.freedesktop.org/drm-tip

It's kinda like linux-next, but for drm. Only downside is that not all drm trees participate in that integration tree.

Simpelst is probably to just base on linux-next and dump everything that hasn't landed after -rc2 onto dri-devel again.

Thanks, I'll work off of that...

And what a tangled web we weave of debugfs files and pointers, it's worse than sysfs here. I'll send another email with why this work is so hard to do...

thanks,

greg k-h
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel