public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Coccinelle: api: Add SmPL script “pm_runtime_mark_last_busy-deletion.cocci”
@ 2026-03-13 17:31 Markus Elfring
  2026-04-21  6:04 ` Markus Elfring
  0 siblings, 1 reply; 2+ messages in thread
From: Markus Elfring @ 2026-03-13 17:31 UTC (permalink / raw)
  To: cocci, kernel-janitors, Julia Lawall, Nicolas Palix
  Cc: LKML, Alejandro Colomar, Felix Gu, Philipp Hahn, Laurent Pinchart,
	Rafael J. Wysocki, Sakari Ailus

From: Markus Elfring <elfring@users.sourceforge.net>
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).

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 .../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

diff --git a/scripts/coccinelle/api/pm_runtime_mark_last_busy-deletion.cocci b/scripts/coccinelle/api/pm_runtime_mark_last_busy-deletion.cocci
new file mode 100644
index 000000000000..fa17fd8ea43b
--- /dev/null
+++ b/scripts/coccinelle/api/pm_runtime_mark_last_busy-deletion.cocci
@@ -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()")
-- 
2.53.0


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

* Re: [PATCH] Coccinelle: api: Add SmPL script “pm_runtime_mark_last_busy-deletion.cocci”
  2026-03-13 17:31 [PATCH] Coccinelle: api: Add SmPL script “pm_runtime_mark_last_busy-deletion.cocci” Markus Elfring
@ 2026-04-21  6:04 ` Markus Elfring
  0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2026-04-21  6:04 UTC (permalink / raw)
  To: cocci, kernel-janitors, Julia Lawall, Nicolas Palix
  Cc: LKML, Alejandro Colomar, Felix Gu, Laurent Pinchart, Philipp Hahn,
	Rafael J. Wysocki, Sakari Ailus

> 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


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

end of thread, other threads:[~2026-04-21  6:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-13 17:31 [PATCH] Coccinelle: api: Add SmPL script “pm_runtime_mark_last_busy-deletion.cocci” Markus Elfring
2026-04-21  6:04 ` Markus Elfring

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