1 // SPDX-License-Identifier: GPL-2.0
2 /// Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE
5 //# Rationale: DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file()
6 //# imposes some significant overhead as compared to
7 //# DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe().
9 // Copyright (C): 2016 Nicolai Stange
10 // Options: --no-includes
19 declarer name DEFINE_SIMPLE_ATTRIBUTE;
21 expression dsa_get, dsa_set, dsa_fmt;
24 DEFINE_SIMPLE_ATTRIBUTE@p(dsa_fops, dsa_get, dsa_set, dsa_fmt);
27 expression name, mode, parent, data;
28 identifier dsa.dsa_fops;
30 debugfs_create_file(name, mode, parent, data, &dsa_fops)
33 @context_dsa depends on context && dcf@
34 declarer name DEFINE_DEBUGFS_ATTRIBUTE;
35 identifier dsa.dsa_fops;
36 expression dsa.dsa_get, dsa.dsa_set, dsa.dsa_fmt;
38 * DEFINE_SIMPLE_ATTRIBUTE(dsa_fops, dsa_get, dsa_set, dsa_fmt);
41 @patch_dcf depends on patch expression@
42 expression name, mode, parent, data;
43 identifier dsa.dsa_fops;
45 - debugfs_create_file(name, mode, parent, data, &dsa_fops)
46 + debugfs_create_file_unsafe(name, mode, parent, data, &dsa_fops)
48 @patch_dsa depends on patch_dcf && patch@
49 identifier dsa.dsa_fops;
50 expression dsa.dsa_get, dsa.dsa_set, dsa.dsa_fmt;
52 - DEFINE_SIMPLE_ATTRIBUTE(dsa_fops, dsa_get, dsa_set, dsa_fmt);
53 + DEFINE_DEBUGFS_ATTRIBUTE(dsa_fops, dsa_get, dsa_set, dsa_fmt);
56 @script:python depends on org && dcf@
60 msg="%s should be defined with DEFINE_DEBUGFS_ATTRIBUTE" % (fops)
61 coccilib.org.print_todo(p[0], msg)
63 @script:python depends on report && dcf@
67 msg="WARNING: %s should be defined with DEFINE_DEBUGFS_ATTRIBUTE" % (fops)
68 coccilib.report.print_report(p[0], msg)