Skip to contentSkip to conversation

mfd: intel-lpss: Clean up and modernize DebugFS usage

PATCH Applied Maria Lisina 4 participants 11 messages Sep 16 – Sep 22

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v7 cover mfd: intel-lpss: Clean up and modernize DebugFS usage

This series cleans up DebugFS code, modernizes it by replacing obsoleted macros and removes redundant error checking.

---
Changes in v7:
- The final corrections after review.
- Link to v6: https://lore.kernel.org/r/[email protected]

Changes in v6:
- Split each logical change into an individual patch.
- Link to v5: https://lore.kernel.org/r/[email protected]

Changes in v5:
- Changed the goal of the patch to DebugFS modernization.
- Refactored intel_lpss_debugfs_add() into a void function.
- Removed deprecated macros and functions.
- Removed dmesg message completely.
- Link to v4: https://lore.kernel.org/r/[email protected]

Changes in v4:
- Keep the dmesg messages, instead check whether DebugFS is initialized
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- Fixed commit name and description.
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Fixed function name in comment section.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Maria Lisina (4):
mfd: intel-lpss: Remove redundant DebugFS error check
mfd: intel-lpss: Use plain octal values for file permissions
mfd: intel-lpss: Remove extra DebugFS dentry
mfd: intel-lpss: Switch to debugfs_remove()

 drivers/mfd/intel-lpss.c | 24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)

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

Best regards,

Signature · 1 line
Maria Lisina <[email protected]>
#1 lore raw

PATCH v7 1/4 mfd: intel-lpss: Remove redundant DebugFS error check

The DebugFS API is designed to handle errors gracefully. Any explicit checking on return values is considered an anti-pattern.

This patch removes unnecessary error checking and converts intel_lpss_debugfs_add() into a void function.

---
 drivers/mfd/intel-lpss.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/mfd/intel-lpss.c +2 -8
index 63d6694f71457b2e09d238af0a9bfb897a169a64..b6958e99cf54d3c8eeca1ba38055a9389678f6c3 100644
@@ -142,13 +142,11 @@ static void intel_lpss_cache_ltr(struct intel_lpss *lpss)
 	lpss->idle_ltr = readl(lpss->priv + LPSS_PRIV_IDLELTR);
 }
 
-static int intel_lpss_debugfs_add(struct intel_lpss *lpss)
+static void intel_lpss_debugfs_add(struct intel_lpss *lpss)
 {
 	struct dentry *dir;
 
 	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);
@@ -158,7 +156,6 @@ static int intel_lpss_debugfs_add(struct intel_lpss *lpss)
 	debugfs_create_x32("idle_ltr", S_IRUGO, dir, &lpss->idle_ltr);
 
 	lpss->debugfs = dir;
-	return 0;
 }
 
 static void intel_lpss_debugfs_remove(struct intel_lpss *lpss)
@@ -432,10 +429,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,
Signature · 1 line
2.47.3
#2 lore raw

Re: [PATCH v7 1/4] mfd: intel-lpss: Remove redundant DebugFS error check

Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 8 lines

The DebugFS API is designed to handle errors gracefully. Any explicit checking on return values is considered an anti-pattern.

This patch removes unnecessary error checking and converts intel_lpss_debugfs_add() into a void function.

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#3 lore raw

PATCH v7 2/4 mfd: intel-lpss: Use plain octal values for file permissions

In reply to Maria Lisina

S_IRUGO macro is obsoleted and not recommended to use, therefore replace it with plain octal values.

---
 drivers/mfd/intel-lpss.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mfd/intel-lpss.c +3 -3
index b6958e99cf54d3c8eeca1ba38055a9389678f6c3..190de88d146aae9418566adf36a47d11afa90b2a 100644
@@ -151,9 +151,9 @@ static void intel_lpss_debugfs_add(struct intel_lpss *lpss)
 	/* Cache the values into lpss structure */
 	intel_lpss_cache_ltr(lpss);
 
-	debugfs_create_x32("capabilities", S_IRUGO, dir, &lpss->caps);
-	debugfs_create_x32("active_ltr", S_IRUGO, dir, &lpss->active_ltr);
-	debugfs_create_x32("idle_ltr", S_IRUGO, dir, &lpss->idle_ltr);
+	debugfs_create_x32("capabilities", 0444, dir, &lpss->caps);
+	debugfs_create_x32("active_ltr", 0444, dir, &lpss->active_ltr);
+	debugfs_create_x32("idle_ltr", 0444, dir, &lpss->idle_ltr);
 
 	lpss->debugfs = dir;
 }
Signature · 1 line
2.47.3
#4 lore raw

Re: [PATCH v7 2/4] mfd: intel-lpss: Use plain octal values for file permissions

Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 5 lines

S_IRUGO macro is obsoleted and not recommended to use, therefore replace it with plain octal values.

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
#5 lore raw

PATCH v7 3/4 mfd: intel-lpss: Remove extra DebugFS dentry

In reply to Maria Lisina

There is no point to keep the variable dir just to assing lpss->debugfs to it later, just use lpss->debugfs directly.

---
 drivers/mfd/intel-lpss.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/mfd/intel-lpss.c +4 -8
index 190de88d146aae9418566adf36a47d11afa90b2a..170cc004a9449cb352e3e1ef22ceb35759368ff4 100644
@@ -144,18 +144,14 @@ static void intel_lpss_cache_ltr(struct intel_lpss *lpss)
 
 static void intel_lpss_debugfs_add(struct intel_lpss *lpss)
 {
-	struct dentry *dir;
-
-	dir = debugfs_create_dir(dev_name(lpss->dev), intel_lpss_debugfs);
+	lpss->debugfs = debugfs_create_dir(dev_name(lpss->dev), intel_lpss_debugfs);
 
 	/* Cache the values into lpss structure */
 	intel_lpss_cache_ltr(lpss);
 
-	debugfs_create_x32("capabilities", 0444, dir, &lpss->caps);
-	debugfs_create_x32("active_ltr", 0444, dir, &lpss->active_ltr);
-	debugfs_create_x32("idle_ltr", 0444, dir, &lpss->idle_ltr);
-
-	lpss->debugfs = dir;
+	debugfs_create_x32("capabilities", 0444, lpss->debugfs, &lpss->caps);
+	debugfs_create_x32("active_ltr", 0444, lpss->debugfs, &lpss->active_ltr);
+	debugfs_create_x32("idle_ltr", 0444, lpss->debugfs, &lpss->idle_ltr);
 }
 
 static void intel_lpss_debugfs_remove(struct intel_lpss *lpss)
Signature · 1 line
2.47.3
#6 lore raw

Re: [PATCH v7 3/4] mfd: intel-lpss: Remove extra DebugFS dentry

Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 5 lines

There is no point to keep the variable dir just to assing lpss->debugfs to it later, just use lpss->debugfs directly.

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
#7 lore raw

PATCH v7 4/4 mfd: intel-lpss: Switch to debugfs_remove()

In reply to Maria Lisina

debugfs_remove_recursive() is deprecated and has become an alias to debugfs_remove(), replace it with the direct debugfs_remove() call instead.

---
 drivers/mfd/intel-lpss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/intel-lpss.c +1 -1
index 170cc004a9449cb352e3e1ef22ceb35759368ff4..29f30ef0da9902a9353eb9c12f6121b4a7ed8c6e 100644
@@ -156,7 +156,7 @@ static void intel_lpss_debugfs_add(struct intel_lpss *lpss)
 
 static void intel_lpss_debugfs_remove(struct intel_lpss *lpss)
 {
-	debugfs_remove_recursive(lpss->debugfs);
+	debugfs_remove(lpss->debugfs);
 }
 
 static void intel_lpss_ltr_set(struct device *dev, s32 val)
Signature · 1 line
2.47.3
#8 lore raw

Re: [PATCH v7 4/4] mfd: intel-lpss: Switch to debugfs_remove()

Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 6 lines

debugfs_remove_recursive() is deprecated and has become an alias to debugfs_remove(), replace it with the direct debugfs_remove() call instead.

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
maintainer Applied
#10 lore raw
In reply to Maria Lisina
Quoted 2 lines · Maria Lisina

This series cleans up DebugFS code, modernizes it by replacing obsoleted macros and removes redundant error checking.

Applied, thanks!

[1/4] mfd: intel-lpss: Remove redundant DebugFS error check

      commit: e32f0b4eb5e799a36ddc13748a56a23e5682d886
[2/4] mfd: intel-lpss: Use plain octal values for file permissions
      commit: bf5001e060762dbb931274db0ad6669492d8150e
[3/4] mfd: intel-lpss: Remove extra DebugFS dentry
      commit: 359ec8b51b4e37fe6435bac44e57f25d0feb346c
[4/4] mfd: intel-lpss: Switch to debugfs_remove()
      commit: 0ab0127dd7445a5e260c97c7d4f792322d0e49be

--
Lee Jones [李琼斯]