linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] docs: debugfs: do not recommend debugfs_remove_recursive
@ 2025-04-29 17:39 Timur Tabi
  2025-04-29 17:47 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 8+ messages in thread
From: Timur Tabi @ 2025-04-29 17:39 UTC (permalink / raw)
  To: Al Viro, linux-doc, Greg Kroah-Hartman, Jonathan Corbet,
	Randy Dunlap

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>
---
 Documentation/filesystems/debugfs.rst         | 19 ++++++-------------
 .../driver_development_debugging_guide.rst    |  2 +-
 2 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/Documentation/filesystems/debugfs.rst b/Documentation/filesystems/debugfs.rst
index 610f718ef8b5..55f807293924 100644
--- a/Documentation/filesystems/debugfs.rst
+++ b/Documentation/filesystems/debugfs.rst
@@ -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/
diff --git a/Documentation/process/debugging/driver_development_debugging_guide.rst b/Documentation/process/debugging/driver_development_debugging_guide.rst
index 46becda8764b..aca08f457793 100644
--- a/Documentation/process/debugging/driver_development_debugging_guide.rst
+++ b/Documentation/process/debugging/driver_development_debugging_guide.rst
@@ -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`.
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-04-30 17:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-29 17:39 [PATCH] docs: debugfs: do not recommend debugfs_remove_recursive Timur Tabi
2025-04-29 17:47 ` Greg Kroah-Hartman
2025-04-29 18:24   ` Timur Tabi
2025-04-30  7:30     ` gregkh
2025-04-30 14:27       ` Timur Tabi
2025-04-30 14:57         ` gregkh
2025-04-30 16:36           ` Timur Tabi
2025-04-30 17:10             ` gregkh

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