On Tue Jan 20, 2026 at 6:54 PM CET, Matthew Maurer wrote:
> I thought the whole point of Greg's admonition to never report errors
> and to automatically create no-op structures if debugfs was disable
> was that we *don't* do things like this, and instead you just do
> something like
>
> ```
> // Always do this, whether or not debugfs is available.
> let debugfs_root = Dir::new("my_thing");
> debugfs_root.scope(data, name, |d, s| { ... })
> ```
>
> If DebugFS is not available, it already returns an empty fake
> directory. That variant of a fake directory is also size 0, so you
> aren't paying anything to use it...

Correct, I also explained that in [1]. This method may be useful if the driver
conditionally wants to provide debugfs entries regardless of CONFIG_DEBUG_FS
though.

Of course, we should only introduce it if we have a user for it.

[1] https://lore.kernel.org/all/[email protected]/

Reply via email to