[PATCH 01/16] coccinelle: misc: secs_to_jiffies: Patch expressions too
Markus Elfring
Markus.Elfring at web.de
Thu Jan 30 11:01:03 UTC 2025
> Teach the script to suggest conversions for timeout patterns where the
> arguments to msecs_to_jiffies() are expressions as well.
Does anything hinder to benefit any more from a source code analysis approach
(like the following by the extended means of the semantic patch language)?
// SPDX-License-Identifier: GPL-2.0
/// Simplify statements by using a known wrapper macro.
/// Replace selected msecs_to_jiffies() calls by secs_to_jiffies().
//
// Keywords: wrapper macro conversion secs seconds jiffies
// Confidence: High
// Options: --no-includes --include-headers
virtual context, patch, report, org
@depends on context@
expression e;
@@
*msecs_to_jiffies
(
(e * 1000
|e * MSEC_PER_SEC
)
)
@depends on patch@
expression e;
@@
-msecs_to_jiffies
+secs_to_jiffies
(
(
-e * 1000
|
-e * MSEC_PER_SEC
)
+e
)
@x depends on org || report@
expression e;
position p;
@@
msecs_to_jiffies at p
(
(e * 1000
|e * MSEC_PER_SEC
)
)
@script:python depends on org@
p << x.p;
@@
coccilib.org.print_todo(p[0], "WARNING: opportunity for secs_to_jiffies()")
@script:python depends on report@
p << x.p;
@@
coccilib.report.print_report(p[0], "WARNING: opportunity for secs_to_jiffies()")
Regards,
Markus
More information about the dri-devel
mailing list