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 <[email protected]>
---
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