]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
clk: tegra: dfll: Fix debugfs_simple_attr.cocci warnings
authorYueHaibing <yuehaibing@huawei.com>
Wed, 9 Jan 2019 12:50:21 +0000 (12:50 +0000)
committerStephen Boyd <sboyd@kernel.org>
Fri, 22 Feb 2019 18:01:21 +0000 (10:01 -0800)
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>
drivers/clk/tegra/clk-dfll.c

index 609e363dabf81400378c84e4ce16e5a209095d8b..7ec752ed349986110f3ff1ad7ea130cc3281dc94 100644 (file)
@@ -1112,8 +1112,8 @@ static int attr_enable_set(void *data, u64 val)
 
        return val ? dfll_enable(td) : dfll_disable(td);
 }
-DEFINE_SIMPLE_ATTRIBUTE(enable_fops, attr_enable_get, attr_enable_set,
-                       "%llu\n");
+DEFINE_DEBUGFS_ATTRIBUTE(enable_fops, attr_enable_get, attr_enable_set,
+                        "%llu\n");
 
 static int attr_lock_get(void *data, u64 *val)
 {
@@ -1129,8 +1129,7 @@ static int attr_lock_set(void *data, u64 val)
 
        return val ? dfll_lock(td) :  dfll_unlock(td);
 }
-DEFINE_SIMPLE_ATTRIBUTE(lock_fops, attr_lock_get, attr_lock_set,
-                       "%llu\n");
+DEFINE_DEBUGFS_ATTRIBUTE(lock_fops, attr_lock_get, attr_lock_set, "%llu\n");
 
 static int attr_rate_get(void *data, u64 *val)
 {
@@ -1147,7 +1146,7 @@ static int attr_rate_set(void *data, u64 val)
 
        return dfll_request_rate(td, val);
 }
-DEFINE_SIMPLE_ATTRIBUTE(rate_fops, attr_rate_get, attr_rate_set, "%llu\n");
+DEFINE_DEBUGFS_ATTRIBUTE(rate_fops, attr_rate_get, attr_rate_set, "%llu\n");
 
 static int attr_registers_show(struct seq_file *s, void *data)
 {
@@ -1196,10 +1195,11 @@ static void dfll_debug_init(struct tegra_dfll *td)
        root = debugfs_create_dir("tegra_dfll_fcpu", NULL);
        td->debugfs_dir = root;
 
-       debugfs_create_file("enable", S_IRUGO | S_IWUSR, root, td, &enable_fops);
-       debugfs_create_file("lock", S_IRUGO, root, td, &lock_fops);
-       debugfs_create_file("rate", S_IRUGO, root, td, &rate_fops);
-       debugfs_create_file("registers", S_IRUGO, root, td, &attr_registers_fops);
+       debugfs_create_file_unsafe("enable", 0644, root, td,
+                                  &enable_fops);
+       debugfs_create_file_unsafe("lock", 0444, root, td, &lock_fops);
+       debugfs_create_file_unsafe("rate", 0444, root, td, &rate_fops);
+       debugfs_create_file("registers", 0444, root, td, &attr_registers_fops);
 }
 
 #else