scripts: coccicheck: fix troubles on non-English builds
[linux-2.6-microblaze.git] / scripts / coccinelle / api / kobj_to_dev.cocci
1 // SPDX-License-Identifier: GPL-2.0-only
2 ///
3 /// Use kobj_to_dev() instead of container_of()
4 ///
5 // Confidence: High
6 // Copyright: (C) 2020 Denis Efremov ISPRAS
7 // Options: --no-includes --include-headers
8 //
9 // Keywords: kobj_to_dev, container_of
10 //
11
12 virtual context
13 virtual report
14 virtual org
15 virtual patch
16
17
18 @r depends on !patch@
19 expression ptr;
20 symbol kobj;
21 position p;
22 @@
23
24 * container_of(ptr, struct device, kobj)@p
25
26
27 @depends on patch@
28 expression ptr;
29 @@
30
31 - container_of(ptr, struct device, kobj)
32 + kobj_to_dev(ptr)
33
34
35 @script:python depends on report@
36 p << r.p;
37 @@
38
39 coccilib.report.print_report(p[0], "WARNING opportunity for kobj_to_dev()")
40
41 @script:python depends on org@
42 p << r.p;
43 @@
44
45 coccilib.org.print_todo(p[0], "WARNING opportunity for kobj_to_dev()")