lkml.org 
[lkml]   [2022]   [Jul]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] coccinelle: api: explicitly request exclusive reset controls
Date
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
\
 
 \ /
  Last update: 2022-07-07 11:22    [W:0.045 / U:1.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site