Re: [PATCH v3] mfd: intel-lpss: Fix DebugFS initialization
From: Andy Shevchenko
Date: Tue Sep 15 2026 - 09:51:10 EST
On Tue, Sep 15, 2026 at 12:02:22PM +0100, Lee Jones wrote:
> On Sun, 13 Sep 2026, Maria Lisina via B4 Relay wrote:
...
> > static int __init intel_lpss_init(void)
> > {
> > intel_lpss_debugfs = debugfs_create_dir("intel_lpss", NULL);
>
> Why not move this and everything else debugfs related to
> intel_lpss_debugfs_add()? Then we can get rid of the awful global
> variable, have everything nicely compartmentalised and ensure that we
> handle each fault gracefully?
This creates a directory under the root of the debugfs, so if you want to have
that not at the driver level, but at the device, it must be a singleton op.
We may achieve this by doing DO_ONCE_SLEEPABLE() from once.h.
Also note, this won't give us the possibility to kill the global variable, as
that one is per-driver, not per-device.
> > + /* Ensure intel_lpss_debugfs stays NULL on error,
> > + * so intel_lpss_debugfs_add() exits properly.
> > + */
> > + if (IS_ERR(intel_lpss_debugfs))
> > + intel_lpss_debugfs = NULL;
> > +
> > return 0;
> > }
> > module_init(intel_lpss_init);
In any case it's orthogonal to the purpose of this patch AFAICS.
If you still think we definitely need to use probe (which I think
doesn't buy us anything but troubles with singleton), I can do it
later on.
--
With Best Regards,
Andy Shevchenko