[PATCH 1/8] drm: Clean up debugfs upon shutdown

Chris Wilson chris at chris-wilson.co.uk
Sun Jul 7 12:02:18 PDT 2013


Driver authors are a forgetful breed, and having to manually clean up
all inodes from debugfs during module unload is tedious and rarely
encountered by users; leftover inodes fester. But behold, the drm core
already tracks all inodes created under the DRI debugfs minor so that we
can do all the teardown ourselves.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Dave Airlie <airlied at redhat.com>
---
 drivers/gpu/drm/drm_debugfs.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
index a05087c..b855fd7 100644
--- a/drivers/gpu/drm/drm_debugfs.c
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -229,7 +229,16 @@ int drm_debugfs_cleanup(struct drm_minor *minor)
 	if (dev->driver->debugfs_cleanup)
 		dev->driver->debugfs_cleanup(minor);
 
-	drm_debugfs_remove_files(drm_debugfs_list, DRM_DEBUGFS_ENTRIES, minor);
+	while (!list_empty(&minor->debugfs_list)) {
+		struct drm_info_node *node =
+			list_first_entry(&minor->debugfs_list,
+					 struct drm_info_node,
+					 list);
+
+		debugfs_remove(node->dent);
+		list_del(&node->list);
+		kfree(node);
+	}
 
 	debugfs_remove(minor->debugfs_root);
 	minor->debugfs_root = NULL;
-- 
1.8.3.2



More information about the dri-devel mailing list