diff mbox series

[v2,1/3] coccinelle: misc: secs_to_jiffies: Patch expressions too

Message ID 20250203-converge-secs-to-jiffies-part-two-v2-1-d7058a01fd0e@linux.microsoft.com (mailing list archive)
State New
Headers show
Series Converge on using secs_to_jiffies() part two | expand

Commit Message

Easwar Hariharan Feb. 3, 2025, 11:50 p.m. UTC
Teach the script to suggest conversions for timeout patterns where the
arguments to msecs_to_jiffies() are expressions as well.

Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
---
 scripts/coccinelle/misc/secs_to_jiffies.cocci | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Markus Elfring Feb. 4, 2025, 7:56 a.m. UTC | #1
> Teach the script to suggest conversions for timeout patterns where the
> arguments to msecs_to_jiffies() are expressions as well.
How do you imagine that the shown SmPL code fits ever to patch reviews?

Examples:
* https://lore.kernel.org/cocci/80cae791-663c-4589-b67e-d4d1049fcd98@web.de/
  https://sympa.inria.fr/sympa/arc/cocci/2025-02/msg00002.html
  https://lkml.org/lkml/2025/2/3/151

* https://lore.kernel.org/cocci/e06cb7f5-7aa3-464c-a8a1-2c7b9b6a29eb@web.de/
  https://sympa.inria.fr/sympa/arc/cocci/2025-01/msg00122.html
  https://lkml.org/lkml/2025/1/30/307


Regards,
Markus
Easwar Hariharan Feb. 4, 2025, 4:20 p.m. UTC | #2
On 2/3/2025 11:56 PM, Markus Elfring wrote:
>> Teach the script to suggest conversions for timeout patterns where the
>> arguments to msecs_to_jiffies() are expressions as well.
> How do you imagine that the shown SmPL code fits ever to patch reviews?

By the simple fact of accomplishing the same result despite differences in
code style, as explicitly called out in the changelog.

- Easwar (he/him)
Markus Elfring Feb. 4, 2025, 8:24 p.m. UTC | #3
>> How do you imagine that the shown SmPL code fits ever to patch reviews?
>
> By the simple fact of accomplishing the same result despite differences in
> code style, as explicitly called out in the changelog.
Do any other contributors care more for the mentioned software development concerns?

How do you think about helping to improve affected implementation details?

Regards,
Markus
diff mbox series

Patch

diff --git a/scripts/coccinelle/misc/secs_to_jiffies.cocci b/scripts/coccinelle/misc/secs_to_jiffies.cocci
index 8bbb2884ea5db939c63fd4513cf5ca8c977aa8cb..416f348174ca659b544441f5f68f04a41d1ad4a3 100644
--- a/scripts/coccinelle/misc/secs_to_jiffies.cocci
+++ b/scripts/coccinelle/misc/secs_to_jiffies.cocci
@@ -20,3 +20,13 @@  virtual patch
 
 - msecs_to_jiffies(C * MSEC_PER_SEC)
 + secs_to_jiffies(C)
+
+@depends on patch@ expression E; @@
+
+- msecs_to_jiffies(E * 1000)
++ secs_to_jiffies(E)
+
+@depends on patch@ expression E; @@
+
+- msecs_to_jiffies(E * MSEC_PER_SEC)
++ secs_to_jiffies(E)