History

coccinelle: api/devm_platform_ioremap_resource: remove useless script

While it is useful for new drivers to use devm_platform_ioremap_resource, this script is currently used to spam maintainers, often updating very old drivers. The net benefit is the removal of 2 lines of code in the driver but the review load for the maintainers is huge. As of now, more that 560 patches have been sent, some of them obviously broken, as in: https://lore.kernel.org/lkml/9bbcce19c777583815c92ce3c2ff2586@www.loen.fr/ Remove the script to reduce the spam.

Alexandre Belloni committed 7 years ago

Commit 283ea341 parent fe7d2c21 file · +0 −60Browse files

Showing the changes to scripts (1 of 1 file). Show all

Unified · Split

scripts/coccinelle/api/devm_platform_ioremap_resource.cocci+0−60
@@ -1,60 +0,0 @@
1// SPDX-License-Identifier: GPL-2.0
2/// Use devm_platform_ioremap_resource helper which wraps
3/// platform_get_resource() and devm_ioremap_resource() together.
4///
5// Confidence: High
6// Copyright: (C) 2019 Himanshu Jha GPLv2.
7// Copyright: (C) 2019 Julia Lawall, Inria/LIP6. GPLv2.
8// Keywords: platform_get_resource, devm_ioremap_resource,
9// Keywords: devm_platform_ioremap_resource
10
11virtual patch
12virtual report
13
14@r depends on patch && !report@
15expression e1, e2, arg1, arg2, arg3;
16identifier id;
17@@
18
19(
20- id = platform_get_resource(arg1, IORESOURCE_MEM, arg2);
21|
22- struct resource *id = platform_get_resource(arg1, IORESOURCE_MEM, arg2);
23)
24 ... when != id
25- e1 = devm_ioremap_resource(arg3, id);
26+ e1 = devm_platform_ioremap_resource(arg1, arg2);
27 ... when != id
28? id = e2
29
30@r1 depends on patch && !report@
31identifier r.id;
32type T;
33@@
34
35- T *id;
36 ...when != id
37
38@r2 depends on report && !patch@
39identifier id;
40expression e1, e2, arg1, arg2, arg3;
41position j0;
42@@
43
44(
45 id = platform_get_resource(arg1, IORESOURCE_MEM, arg2);
46|
47 struct resource *id = platform_get_resource(arg1, IORESOURCE_MEM, arg2);
48)
49 ... when != id
50 e1@j0 = devm_ioremap_resource(arg3, id);
51 ... when != id
52? id = e2
53
54@script:python depends on report && !patch@
55e1 << r2.e1;
56j0 << r2.j0;
57@@
58
59msg = "WARNING: Use devm_platform_ioremap_resource for %s" % (e1)
60coccilib.report.print_report(j0[0], msg)