mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3] mfd: intel-lpss: Fix DebugFS initialization
@ 2026-09-13 12:53 Maria Lisina via B4 Relay
  2026-09-14  4:29 ` Andy Shevchenko
  2026-09-15 11:02 ` Lee Jones
  0 siblings, 2 replies; 4+ messages in thread
From: Maria Lisina via B4 Relay @ 2026-09-13 12:53 UTC (permalink / raw)
  To: Andy Shevchenko, Lee Jones; +Cc: mfd, linux-kernel, Maria Lisina

From: Maria Lisina <sekoohaka.sarisan@gmail.com>

The original code defers DebugFS check with unnecessary warning message
which also appears when DebugFS is simply disabled.

Therefore it spams dmesg with these messages:

  intel-lpss 0000:00:15.0: Failed to create debugfs entries
  intel-lpss 0000:00:15.3: Failed to create debugfs entries
  intel-lpss 0000:00:1e.0: Failed to create debugfs entries
  intel-lpss 0000:00:1e.2: Failed to create debugfs entries

This patch adds proper checks to intel_lpss_init() and
intel_lpss_debugfs_add() functions and removes warning message.

Signed-off-by: Maria Lisina <sekoohaka.sarisan@gmail.com>
---
Changes in v3:
- Fixed commit name and description.
- Link to v2: https://lore.kernel.org/r/20260913-intel-lpss-debugfs-v2-1-a1a4faf5cc63@gmail.com

Changes in v2:
- Fixed function name in comment section.
- Link to v1: https://lore.kernel.org/r/20260913-intel-lpss-debugfs-v1-1-833cbb6fffc9@gmail.com
---
 drivers/mfd/intel-lpss.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/mfd/intel-lpss.c b/drivers/mfd/intel-lpss.c
index 63d6694f71457b2e09d238af0a9bfb897a169a64..c2cb58c0f98a996d5a2718956092e74139f2a286 100644
--- a/drivers/mfd/intel-lpss.c
+++ b/drivers/mfd/intel-lpss.c
@@ -146,9 +146,12 @@ static int intel_lpss_debugfs_add(struct intel_lpss *lpss)
 {
 	struct dentry *dir;
 
+	if (!intel_lpss_debugfs) {
+		lpss->debugfs = NULL;
+		return 0;
+	}
+
 	dir = debugfs_create_dir(dev_name(lpss->dev), intel_lpss_debugfs);
-	if (IS_ERR(dir))
-		return PTR_ERR(dir);
 
 	/* Cache the values into lpss structure */
 	intel_lpss_cache_ltr(lpss);
@@ -432,10 +435,7 @@ int intel_lpss_probe(struct device *dev,
 		goto err_clk_register;
 
 	intel_lpss_ltr_expose(lpss);
-
-	ret = intel_lpss_debugfs_add(lpss);
-	if (ret)
-		dev_warn(dev, "Failed to create debugfs entries\n");
+	intel_lpss_debugfs_add(lpss);
 
 	if (intel_lpss_has_idma(lpss)) {
 		ret = mfd_add_devices(dev, lpss->devid, &intel_lpss_idma64_cell,
@@ -539,6 +539,13 @@ EXPORT_NS_GPL_DEV_PM_OPS(intel_lpss_pm_ops, INTEL_LPSS) = {
 static int __init intel_lpss_init(void)
 {
 	intel_lpss_debugfs = debugfs_create_dir("intel_lpss", NULL);
+
+	/* 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);

---
base-commit: 2f0c1cf72f4682178506f513bbf015e591b1aa4a
change-id: 20260913-intel-lpss-debugfs-eff3580d1295

Best regards,
-- 
Maria Lisina <sekoohaka.sarisan@gmail.com>



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

* Re: [PATCH v3] mfd: intel-lpss: Fix DebugFS initialization
  2026-09-13 12:53 [PATCH v3] mfd: intel-lpss: Fix DebugFS initialization Maria Lisina via B4 Relay
@ 2026-09-14  4:29 ` Andy Shevchenko
  2026-09-15 11:02 ` Lee Jones
  1 sibling, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2026-09-14  4:29 UTC (permalink / raw)
  To: sekoohaka.sarisan; +Cc: Lee Jones, mfd, linux-kernel

On Sun, Sep 13, 2026 at 05:53:53PM +0500, Maria Lisina via B4 Relay wrote:

This is a fair report and patch, but three versions over a night?!
Please, slow down! Even with this kind of patch you have to wait
at least 24h between versions.

> The original code defers DebugFS check with unnecessary warning message
> which also appears when DebugFS is simply disabled.
> 
> Therefore it spams dmesg with these messages:
> 
>   intel-lpss 0000:00:15.0: Failed to create debugfs entries
>   intel-lpss 0000:00:15.3: Failed to create debugfs entries
>   intel-lpss 0000:00:1e.0: Failed to create debugfs entries
>   intel-lpss 0000:00:1e.2: Failed to create debugfs entries

One message is enough as an example.

> This patch adds proper checks to intel_lpss_init() and
> intel_lpss_debugfs_add() functions and removes warning message.

...

> -	ret = intel_lpss_debugfs_add(lpss);
> -	if (ret)
> -		dev_warn(dev, "Failed to create debugfs entries\n");
> +	intel_lpss_debugfs_add(lpss);

Obviously this message is added here deliberately. If you are annoyed by it,
we may consider dropping the level.

...

> +	/* Ensure intel_lpss_debugfs stays NULL on error,
> +	 * so intel_lpss_debugfs_add() exits properly.
> +	 */

/*
 * Wrong comment style for multi-line
 * comments.
 */

...

TL;DR: moving from warn to info or debug level  would be a good compromise.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v3] mfd: intel-lpss: Fix DebugFS initialization
  2026-09-13 12:53 [PATCH v3] mfd: intel-lpss: Fix DebugFS initialization Maria Lisina via B4 Relay
  2026-09-14  4:29 ` Andy Shevchenko
@ 2026-09-15 11:02 ` Lee Jones
  2026-09-15 13:32   ` Andy Shevchenko
  1 sibling, 1 reply; 4+ messages in thread
From: Lee Jones @ 2026-09-15 11:02 UTC (permalink / raw)
  To: sekoohaka.sarisan; +Cc: Andy Shevchenko, mfd, linux-kernel

On Sun, 13 Sep 2026, Maria Lisina via B4 Relay wrote:

> From: Maria Lisina <sekoohaka.sarisan@gmail.com>
> 
> The original code defers DebugFS check with unnecessary warning message
> which also appears when DebugFS is simply disabled.
> 
> Therefore it spams dmesg with these messages:
> 
>   intel-lpss 0000:00:15.0: Failed to create debugfs entries
>   intel-lpss 0000:00:15.3: Failed to create debugfs entries
>   intel-lpss 0000:00:1e.0: Failed to create debugfs entries
>   intel-lpss 0000:00:1e.2: Failed to create debugfs entries
> 
> This patch adds proper checks to intel_lpss_init() and
> intel_lpss_debugfs_add() functions and removes warning message.
> 
> Signed-off-by: Maria Lisina <sekoohaka.sarisan@gmail.com>
> ---
> Changes in v3:
> - Fixed commit name and description.
> - Link to v2: https://lore.kernel.org/r/20260913-intel-lpss-debugfs-v2-1-a1a4faf5cc63@gmail.com
> 
> Changes in v2:
> - Fixed function name in comment section.
> - Link to v1: https://lore.kernel.org/r/20260913-intel-lpss-debugfs-v1-1-833cbb6fffc9@gmail.com
> ---
>  drivers/mfd/intel-lpss.c | 19 +++++++++++++------
>  1 file changed, 13 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/mfd/intel-lpss.c b/drivers/mfd/intel-lpss.c
> index 63d6694f71457b2e09d238af0a9bfb897a169a64..c2cb58c0f98a996d5a2718956092e74139f2a286 100644
> --- a/drivers/mfd/intel-lpss.c
> +++ b/drivers/mfd/intel-lpss.c
> @@ -146,9 +146,12 @@ static int intel_lpss_debugfs_add(struct intel_lpss *lpss)
>  {
>  	struct dentry *dir;
>  
> +	if (!intel_lpss_debugfs) {
> +		lpss->debugfs = NULL;
> +		return 0;
> +	}
> +
>  	dir = debugfs_create_dir(dev_name(lpss->dev), intel_lpss_debugfs);
> -	if (IS_ERR(dir))
> -		return PTR_ERR(dir);
>  
>  	/* Cache the values into lpss structure */
>  	intel_lpss_cache_ltr(lpss);
> @@ -432,10 +435,7 @@ int intel_lpss_probe(struct device *dev,
>  		goto err_clk_register;
>  
>  	intel_lpss_ltr_expose(lpss);
> -
> -	ret = intel_lpss_debugfs_add(lpss);
> -	if (ret)
> -		dev_warn(dev, "Failed to create debugfs entries\n");
> +	intel_lpss_debugfs_add(lpss);
>  
>  	if (intel_lpss_has_idma(lpss)) {
>  		ret = mfd_add_devices(dev, lpss->devid, &intel_lpss_idma64_cell,
> @@ -539,6 +539,13 @@ EXPORT_NS_GPL_DEV_PM_OPS(intel_lpss_pm_ops, INTEL_LPSS) = {
>  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?

> +
> +	/* 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);
> 
> ---
> base-commit: 2f0c1cf72f4682178506f513bbf015e591b1aa4a
> change-id: 20260913-intel-lpss-debugfs-eff3580d1295
> 
> Best regards,
> -- 
> Maria Lisina <sekoohaka.sarisan@gmail.com>
> 
> 

-- 
Lee Jones

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

* Re: [PATCH v3] mfd: intel-lpss: Fix DebugFS initialization
  2026-09-15 11:02 ` Lee Jones
@ 2026-09-15 13:32   ` Andy Shevchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2026-09-15 13:32 UTC (permalink / raw)
  To: Lee Jones; +Cc: sekoohaka.sarisan, mfd, linux-kernel

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



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

end of thread, other threads:[~2026-09-15 13:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-13 12:53 [PATCH v3] mfd: intel-lpss: Fix DebugFS initialization Maria Lisina via B4 Relay
2026-09-14  4:29 ` Andy Shevchenko
2026-09-15 11:02 ` Lee Jones
2026-09-15 13:32   ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®