From: Markus Elfring <Markus.Elfring@web.de>
To: cocci@inria.fr, kernel-janitors@vger.kernel.org,
Julia Lawall <Julia.Lawall@inria.fr>,
Nicolas Palix <nicolas.palix@imag.fr>
Cc: LKML <linux-kernel@vger.kernel.org>,
Alejandro Colomar <alx@kernel.org>, Felix Gu <ustc.gu@gmail.com>,
Philipp Hahn <phahn-oss@avm.de>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>
Subject: [PATCH] Coccinelle: api: Add SmPL script “pm_runtime_mark_last_busy-deletion.cocci”
Date: Fri, 13 Mar 2026 18:31:02 +0100 [thread overview]
Message-ID: <4fa1cbbe-506d-4acc-acd6-57700d76d0e2@web.de> (raw)
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
reply other threads:[~2026-03-13 17:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4fa1cbbe-506d-4acc-acd6-57700d76d0e2@web.de \
--to=markus.elfring@web.de \
--cc=Julia.Lawall@inria.fr \
--cc=alx@kernel.org \
--cc=cocci@inria.fr \
--cc=kernel-janitors@vger.kernel.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nicolas.palix@imag.fr \
--cc=phahn-oss@avm.de \
--cc=rafael.j.wysocki@intel.com \
--cc=sakari.ailus@linux.intel.com \
--cc=ustc.gu@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox