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.
Unified · Split
| @@ -229,22 +229,15 @@ module is unloaded without explicitly removing debugfs entries, the result · 228 unmodified lines | |||
| 229 | will be a lot of stale pointers and no end of highly antisocial behavior. | 229 | will be a lot of stale pointers and no end of highly antisocial behavior. |
| 230 | So all debugfs users - at least those which can be built as modules - must | 230 | So all debugfs users - at least those which can be built as modules - must |
| 231 | be prepared to remove all files and directories they create there. A file | 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 | void debugfs_remove(struct dentry *dentry); | 234 | void debugfs_remove(struct dentry *dentry); |
| 235 | 235 | ||
| 236 | The dentry value can be NULL or an error value, in which case nothing will | 236 | The dentry value can be NULL or an error value, in which case nothing will |
| 237 | be removed. | 237 | be removed. Note that this function will recursively remove all files and |
| 238 | 238 | directories underneath it. Previously, debugfs_remove_recursive() was used | |
| 239 | Once upon a time, debugfs users were required to remember the dentry | 239 | to perform that task, but this function is now just an alias to |
| 240 | pointer for every debugfs file they created so that all files could be | 240 | debugfs_remove(). debugfs_remove_recursive() should be considered |
| 241 | cleaned up. We live in more civilized times now, though, and debugfs users | 241 | deprecated. |
| 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. | ||
| 249 | 242 | ||
| 250 | .. [1] http://lwn.net/Articles/309298/ | 243 | .. [1] http://lwn.net/Articles/309298/ |
| @@ -155,7 +155,7 @@ The general idea is: · 154 unmodified lines | |||
| 155 | ``my_variable`` | 155 | ``my_variable`` |
| 156 | 156 | ||
| 157 | - Clean up the directory when removing the device | 157 | - Clean up the directory when removing the device |
| 158 | (``debugfs_remove_recursive(parent);``) | 158 | (``debugfs_remove(parent);``) |
| 159 | 159 | ||
| 160 | For the full documentation see :doc:`/filesystems/debugfs`. | 160 | For the full documentation see :doc:`/filesystems/debugfs`. |
| 161 | 161 | ||