]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
docs: debugfs: do not recommend debugfs_remove_recursive
authorTimur Tabi <ttabi@nvidia.com>
Tue, 29 Apr 2025 17:39:58 +0000 (12:39 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Apr 2025 17:11:04 +0000 (19:11 +0200)
Update the debugfs documentation to indicate that debugfs_remove()
should be used to clean up debugfs entries.

In commit a3d1e7eb5abe ("simple_recursive_removal(): kernel-side rm -rf
for ramfs-style filesystems"), function debugfs_remove_recursive()
was made into an alias for debugfs_remove():

    #define debugfs_remove_recursive debugfs_remove

Therefore, drivers should just use debugfs_remove() going forward.

Signed-off-by: Timur Tabi <ttabi@nvidia.com>
Link: https://lore.kernel.org/r/20250429173958.3973958-1-ttabi@nvidia.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Documentation/filesystems/debugfs.rst
Documentation/process/debugging/driver_development_debugging_guide.rst

index 610f718ef8b544b5eb26df0491ef2ed74597bc56..55f8072939247629ad631e76073b44f98e6633b4 100644 (file)
@@ -229,22 +229,15 @@ module is unloaded without explicitly removing debugfs entries, the result
 will be a lot of stale pointers and no end of highly antisocial behavior.
 So all debugfs users - at least those which can be built as modules - must
 be prepared to remove all files and directories they create there.  A file
-can be removed with::
+or directory can be removed with::
 
     void debugfs_remove(struct dentry *dentry);
 
 The dentry value can be NULL or an error value, in which case nothing will
-be removed.
-
-Once upon a time, debugfs users were required to remember the dentry
-pointer for every debugfs file they created so that all files could be
-cleaned up.  We live in more civilized times now, though, and debugfs users
-can call::
-
-    void debugfs_remove_recursive(struct dentry *dentry);
-
-If this function is passed a pointer for the dentry corresponding to the
-top-level directory, the entire hierarchy below that directory will be
-removed.
+be removed.  Note that this function will recursively remove all files and
+directories underneath it.  Previously, debugfs_remove_recursive() was used
+to perform that task, but this function is now just an alias to
+debugfs_remove().  debugfs_remove_recursive() should be considered
+deprecated.
 
 .. [1] http://lwn.net/Articles/309298/
index 46becda8764b0b702bfe550b6dcf048b08879e1d..aca08f457793e8a398159bb203003ea8576e19b1 100644 (file)
@@ -155,7 +155,7 @@ The general idea is:
     ``my_variable``
 
 - Clean up the directory when removing the device
-  (``debugfs_remove_recursive(parent);``)
+  (``debugfs_remove(parent);``)
 
 For the full documentation see :doc:`/filesystems/debugfs`.