[PATCH] coccinelle: api: kobj_to_dev: don't warn about kobj_to_dev()
From: Denis Efremov
Date: Tue Sep 01 2020 - 05:28:09 EST
Exclude kobj_to_dev() definition from warnings.
Signed-off-by: Denis Efremov <efremov@xxxxxxxxx>
---
No changes in performance. This patch can be squashed to the
original patch with kobj_to_dev.cocci script.
scripts/coccinelle/api/kobj_to_dev.cocci | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/scripts/coccinelle/api/kobj_to_dev.cocci b/scripts/coccinelle/api/kobj_to_dev.cocci
index cd5d31c6fe76..d0b3b9647c19 100644
--- a/scripts/coccinelle/api/kobj_to_dev.cocci
+++ b/scripts/coccinelle/api/kobj_to_dev.cocci
@@ -15,10 +15,18 @@ virtual org
virtual patch
+@initialize:python@
+@@
+filter = frozenset(['kobj_to_dev'])
+
+def relevant(p):
+ return not (filter & {el.current_element for el in p})
+
+
@r depends on !patch@
expression ptr;
symbol kobj;
-position p;
+position p : script:python() { relevant(p) };
@@
* container_of(ptr, struct device, kobj)@p
@@ -26,9 +34,10 @@ position p;
@depends on patch@
expression ptr;
+position p : script:python() { relevant(p) };
@@
-- container_of(ptr, struct device, kobj)
+- container_of(ptr, struct device, kobj)@p
+ kobj_to_dev(ptr)
--
2.26.2