Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

docs: debugfs: do not recommend debugfs_remove_recursive

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>

authored by

Timur Tabi and committed by
Greg Kroah-Hartman
e99efa8a 0e4965c8

+7 -14
+6 -13
Documentation/filesystems/debugfs.rst
··· 229 229 will be a lot of stale pointers and no end of highly antisocial behavior. 230 230 So all debugfs users - at least those which can be built as modules - must 231 231 be prepared to remove all files and directories they create there. A file 232 - can be removed with:: 232 + or directory can be removed with:: 233 233 234 234 void debugfs_remove(struct dentry *dentry); 235 235 236 236 The dentry value can be NULL or an error value, in which case nothing will 237 - be removed. 238 - 239 - Once upon a time, debugfs users were required to remember the dentry 240 - pointer for every debugfs file they created so that all files could be 241 - cleaned up. We live in more civilized times now, though, and debugfs users 242 - can call:: 243 - 244 - void debugfs_remove_recursive(struct dentry *dentry); 245 - 246 - If this function is passed a pointer for the dentry corresponding to the 247 - top-level directory, the entire hierarchy below that directory will be 248 - removed. 237 + be removed. Note that this function will recursively remove all files and 238 + directories underneath it. Previously, debugfs_remove_recursive() was used 239 + to perform that task, but this function is now just an alias to 240 + debugfs_remove(). debugfs_remove_recursive() should be considered 241 + deprecated. 249 242 250 243 .. [1] http://lwn.net/Articles/309298/
+1 -1
Documentation/process/debugging/driver_development_debugging_guide.rst
··· 155 155 ``my_variable`` 156 156 157 157 - Clean up the directory when removing the device 158 - (``debugfs_remove_recursive(parent);``) 158 + (``debugfs_remove(parent);``) 159 159 160 160 For the full documentation see :doc:`/filesystems/debugfs`. 161 161