Skip to contentSkip to conversation

Coccinelle: api: Add SmPL script “pm_runtime_mark_last_busy-deletion.cocci”

PATCH In review Markus Elfring 1 participant 2 messages Mar 13 – Apr 21

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

PATCH 1/1 Coccinelle: api: Add SmPL script “pm_runtime_mark_last_busy-deletion.cocci”

From: Markus Elfring <[email protected]>
Date: Fri, 13 Mar 2026 18:15:11 +0100

The device's last busy timestamp was set in a wrapper function since the commit b3db492e8335417dfd66c1fa2ea08e1d2f7b6736 ("PM: runtime:
Mark last busy stamp in pm_runtime_put_autosuspend()"). Thus delete pm_runtime_mark_last_busy() calls before pm_runtime_put_autosuspend() calls.
Provide design options for the adjustment of affected source code by the means of the semantic patch language (Coccinelle software).

---
 .../pm_runtime_mark_last_busy-deletion.cocci  | 37 +++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 scripts/coccinelle/api/pm_runtime_mark_last_busy-deletion.cocci
scripts/coccinelle/api/pm_runtime_mark_last_busy-deletion.cocci new file +37 -0
new file mode 100644
index 000000000000..fa17fd8ea43b
@@ -0,0 +1,37 @@
+// SPDX-License-Identifier: GPL-2.0
+/// Omit pm_runtime_mark_last_busy() call before pm_runtime_put_autosuspend().
+//
+// Keywords: wrapper function access timestamp autosuspend
+// Confidence: High
+// Options: --no-includes --include-headers
+
+virtual context, patch, report, org
+
+@depends on context@
+expression e;
+@@
+*pm_runtime_mark_last_busy(e);
+ pm_runtime_put_autosuspend(e);
+
+@depends on patch@
+expression e;
+@@
+-pm_runtime_mark_last_busy(e);
+ pm_runtime_put_autosuspend(e);
+
+@x depends on org || report@
+expression e;
+position p;
+@@
+ pm_runtime_mark_last_busy@p(e);
+ pm_runtime_put_autosuspend(e);
+
+@script:python depends on org@
+p << x.p;
+@@
+coccilib.org.print_todo(p[0], "WARNING: Delete pm_runtime_mark_last_busy() call before pm_runtime_put_autosuspend()")
+
+@script:python depends on report@
+p << x.p;
+@@
+coccilib.report.print_report(p[0], "WARNING: Delete pm_runtime_mark_last_busy() call before pm_runtime_put_autosuspend()")
Signature · 1 line
2.53.0
#1 lore raw
Quoted 9 lines

Date: Fri, 13 Mar 2026 18:15:11 +0100

The device's last busy timestamp was set in a wrapper function since the commit b3db492e8335417dfd66c1fa2ea08e1d2f7b6736 ("PM: runtime:
Mark last busy stamp in pm_runtime_put_autosuspend()"). Thus delete pm_runtime_mark_last_busy() calls before pm_runtime_put_autosuspend() calls.
Provide design options for the adjustment of affected source code by the means of the semantic patch language (Coccinelle software).

How many contributors will get into the mood to achieve further collateral evolution also with the help of such an SmPL script?

Regards,
Markus