From: Markus Elfring <Markus.Elfring@web.de>
To: cocci@inria.fr, Julia Lawall <Julia.Lawall@inria.fr>
Cc: LKML <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Easwar Hariharan <eahariha@linux.microsoft.com>,
Nicolas Palix <nicolas.palix@imag.fr>,
Ricardo Ribalda <ribalda@chromium.org>,
Victor Gambier <victor.gambier@inria.fr>
Subject: Re: [01/16] coccinelle: misc: secs_to_jiffies: Patch expressions too
Date: Mon, 3 Feb 2025 08:24:19 +0100 [thread overview]
Message-ID: <80cae791-663c-4589-b67e-d4d1049fcd98@web.de> (raw)
In-Reply-To: <9ca0337d-e378-4de5-99be-1dfa1d4f8cff@web.de>
> I tend also to present possibilities for succinct SmPL code.
> Unfortunately, software dependencies can trigger corresponding target conflicts.
@adjustment@
expression e;
@@
-msecs_to_jiffies
+secs_to_jiffies
(
(
-e * 1000
|
-e * MSEC_PER_SEC
)
+e
)
A command (like the following) can indicate how isomorphisms are applied
for the transformation of some data into SmPL disjunctions.
https://gitlab.inria.fr/coccinelle/coccinelle/-/blob/bd08cad3f802229dc629a13eefef2018c620e905/standard.iso#L252-257
Markus_Elfring@Sonne:…/Projekte/Coccinelle/Probe> spatch --parse-cocci suggestion3_for_Easwar_Hariharan-20250128.cocci
…
@adjustment@
expression e;
@@
(
-msecs_to_jiffies
>>> secs_to_jiffies
(-e -* -1000
<<< e
)
|
-msecs_to_jiffies
>>> secs_to_jiffies
(-1000 -* -e
<<< e
)
|
-msecs_to_jiffies
>>> secs_to_jiffies
(-e -* -MSEC_PER_SEC
<<< e
)
|
-msecs_to_jiffies
>>> secs_to_jiffies
(-MSEC_PER_SEC -* -e
<<< e
)
)
Grep query
msecs_to_jiffies
I find parts of such a data representation improvable.
I would usually expect here that parentheses for the selection of call parameters
will not appear in the first text column
(so that confusion will be avoided for the usage of delimiters according to SmPL disjunctions).
The isomorphism specifications represent also a software development status.
It seems that they do not contain direct support for SmPL disjunctions so far
(as an explicit entity).
The identifier “HZ” is used by the referenced macro.
https://elixir.bootlin.com/linux/v6.13/source/include/linux/jiffies.h#L530-L540
https://lore.kernel.org/linux-kernel/173831299312.31546.8797889985487965830.tip-bot2@tip-bot2/
Is there a need to take further (preprocessor symbol) variations better into account?
How do you think about the handling of multiplication factors within bigger expressions
(and not only at the beginning or end of a term)?
Would you be looking for further restrictions on expression combinations?
Regards,
Markus
next prev parent reply other threads:[~2025-02-03 7:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20250128-converge-secs-to-jiffies-part-two-v1-1-9a6ecf0b2308@linux.microsoft.com>
2025-01-28 21:02 ` [PATCH 01/16] coccinelle: misc: secs_to_jiffies: Patch expressions too Markus Elfring
2025-01-29 5:05 ` Easwar Hariharan
2025-01-29 9:40 ` [01/16] " Markus Elfring
2025-02-03 7:24 ` Markus Elfring [this message]
2025-01-30 11:01 ` [PATCH 01/16] " Markus Elfring
2025-02-01 0:11 ` Easwar Hariharan
2025-02-03 7:22 ` [01/16] " Markus Elfring
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=80cae791-663c-4589-b67e-d4d1049fcd98@web.de \
--to=markus.elfring@web.de \
--cc=Julia.Lawall@inria.fr \
--cc=akpm@linux-foundation.org \
--cc=cocci@inria.fr \
--cc=eahariha@linux.microsoft.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nicolas.palix@imag.fr \
--cc=ribalda@chromium.org \
--cc=victor.gambier@inria.fr \
/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