* [cocci] [PATCH] coccinelle: api: explicitly request exclusive reset controls
@ 2022-07-07 9:20 Philipp Zabel
2022-07-07 17:38 ` Markus Elfring
0 siblings, 1 reply; 2+ messages in thread
From: Philipp Zabel @ 2022-07-07 9:20 UTC (permalink / raw)
To: Julia Lawall, Nicolas Palix; +Cc: linux-kernel, cocci, Philipp Zabel
Match deprecated reset_control_get API calls and replace them with the
corresponding _exclusive variants with the reset-exclusive.cocci rule,
to hopefully advance the API transition started with commit a53e35db70d1
("reset: Ensure drivers are explicit when requesting reset lines").
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
scripts/coccinelle/api/reset-exclusive.cocci | 49 ++++++++++++++++++++
1 file changed, 49 insertions(+)
create mode 100644 scripts/coccinelle/api/reset-exclusive.cocci
diff --git a/scripts/coccinelle/api/reset-exclusive.cocci b/scripts/coccinelle/api/reset-exclusive.cocci
new file mode 100644
index 000000000000..c5d6938ca542
--- /dev/null
+++ b/scripts/coccinelle/api/reset-exclusive.cocci
@@ -0,0 +1,49 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/// Explicitly request exclusive reset controls. The implicitly exclusive reset
+/// control request functions are deprecated.
+///
+// Confidence: High
+// Copyright: (C) 2022 Philipp Zabel.
+// Comments:
+// Options: --no-includes --include-headers
+// Keywords: reset_control_get
+
+virtual patch
+virtual report
+
+@depends on patch@
+expression x;
+@@
+
+ x =
+(
+-devm_reset_control_get
++devm_reset_control_get_exclusive
+|
+-devm_reset_control_get_optional
++devm_reset_control_get_optional_exclusive
+|
+-of_reset_control_get
++of_reset_control_get_exclusive
+|
+-of_reset_control_get_by_index
++of_reset_control_get_exclusive_by_index
+|
+-devm_reset_control_get_by_index
++devm_reset_control_get_exclusive_by_index
+)
+ (...)
+
+@r depends on !patch exists@
+expression x;
+position p;
+@@
+
+*x = \(devm_reset_control_get@p\|devm_reset_control_get_optional@p\|of_reset_control_get@p\|of_rset_control_get_by_index@p\|devm_reset_control_get_by_index@p\)(...)
+
+@script:python depends on report@
+p << r.p;
+@@
+
+msg = "ERROR: explicitly request exclusive reset controls with reset_control_get_exclusive() and variants"
+coccilib.report.print_report(p[0], msg)
--
2.30.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [cocci] [PATCH] coccinelle: api: explicitly request exclusive reset controls
2022-07-07 9:20 [cocci] [PATCH] coccinelle: api: explicitly request exclusive reset controls Philipp Zabel
@ 2022-07-07 17:38 ` Markus Elfring
0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2022-07-07 17:38 UTC (permalink / raw)
To: Philipp Zabel, cocci, kernel-janitors
Cc: Julia Lawall, Nicolas Palix, linux-kernel
> scripts/coccinelle/api/reset-exclusive.cocci | 49 ++++++++++++++++++++
…
> +virtual patch
> +virtual report
How do you think about to support also the operation modes “context” and “org”?
> +@depends on patch@
> +expression x;
> +@@
> +
> + x =
> +(
> +-devm_reset_control_get
> ++devm_reset_control_get_exclusive
> +|
> +-devm_reset_control_get_optional
> ++devm_reset_control_get_optional_exclusive
> +|
> +-of_reset_control_get
> ++of_reset_control_get_exclusive
> +|
> +-of_reset_control_get_by_index
> ++of_reset_control_get_exclusive_by_index
> +|
> +-devm_reset_control_get_by_index
> ++devm_reset_control_get_exclusive_by_index
> +)
> + (...)
Did you order the case distinctions in the SmPL disjunction according to
the call frequencies of the mentioned function names?
> +@r depends on !patch exists@
> +expression x;
> +position p;
> +@@
> +
> +*x = \(devm_reset_control_get@p\|devm_reset_control_get_optional@p\|of_reset_control_get@p\|of_rset_control_get_by_index@p\|devm_reset_control_get_by_index@p\)(...)
I suggest to reconsider the influence of data processing according to
the SmPL asterisk functionality a bit more.
Regards,
Markus
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-07 17:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-07 9:20 [cocci] [PATCH] coccinelle: api: explicitly request exclusive reset controls Philipp Zabel
2022-07-07 17:38 ` Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).