Skip to content

Commit e7e6198

Browse files
YueHaibingbebarino
authored andcommitted
clk: tegra: dfll: Fix debugfs_simple_attr.cocci warnings
Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE for debugfs files. Semantic patch information: Rationale: DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file() imposes some significant overhead as compared to DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe(). Generated by: scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci Signed-off-by: YueHaibing <yuehaibing@huawei.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent 8f99f5e commit e7e6198

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

drivers/clk/tegra/clk-dfll.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,8 +1112,8 @@ static int attr_enable_set(void *data, u64 val)
11121112

11131113
return val ? dfll_enable(td) : dfll_disable(td);
11141114
}
1115-
DEFINE_SIMPLE_ATTRIBUTE(enable_fops, attr_enable_get, attr_enable_set,
1116-
"%llu\n");
1115+
DEFINE_DEBUGFS_ATTRIBUTE(enable_fops, attr_enable_get, attr_enable_set,
1116+
"%llu\n");
11171117

11181118
static int attr_lock_get(void *data, u64 *val)
11191119
{
@@ -1129,8 +1129,7 @@ static int attr_lock_set(void *data, u64 val)
11291129

11301130
return val ? dfll_lock(td) : dfll_unlock(td);
11311131
}
1132-
DEFINE_SIMPLE_ATTRIBUTE(lock_fops, attr_lock_get, attr_lock_set,
1133-
"%llu\n");
1132+
DEFINE_DEBUGFS_ATTRIBUTE(lock_fops, attr_lock_get, attr_lock_set, "%llu\n");
11341133

11351134
static int attr_rate_get(void *data, u64 *val)
11361135
{
@@ -1147,7 +1146,7 @@ static int attr_rate_set(void *data, u64 val)
11471146

11481147
return dfll_request_rate(td, val);
11491148
}
1150-
DEFINE_SIMPLE_ATTRIBUTE(rate_fops, attr_rate_get, attr_rate_set, "%llu\n");
1149+
DEFINE_DEBUGFS_ATTRIBUTE(rate_fops, attr_rate_get, attr_rate_set, "%llu\n");
11511150

11521151
static int attr_registers_show(struct seq_file *s, void *data)
11531152
{
@@ -1196,10 +1195,11 @@ static void dfll_debug_init(struct tegra_dfll *td)
11961195
root = debugfs_create_dir("tegra_dfll_fcpu", NULL);
11971196
td->debugfs_dir = root;
11981197

1199-
debugfs_create_file("enable", S_IRUGO | S_IWUSR, root, td, &enable_fops);
1200-
debugfs_create_file("lock", S_IRUGO, root, td, &lock_fops);
1201-
debugfs_create_file("rate", S_IRUGO, root, td, &rate_fops);
1202-
debugfs_create_file("registers", S_IRUGO, root, td, &attr_registers_fops);
1198+
debugfs_create_file_unsafe("enable", 0644, root, td,
1199+
&enable_fops);
1200+
debugfs_create_file_unsafe("lock", 0444, root, td, &lock_fops);
1201+
debugfs_create_file_unsafe("rate", 0444, root, td, &rate_fops);
1202+
debugfs_create_file("registers", 0444, root, td, &attr_registers_fops);
12031203
}
12041204

12051205
#else

0 commit comments

Comments
 (0)