From: kernel test robot <lkp(a)intel.com>
drivers/cpuidle/test-cpuidle_latency.c:95:0-23: WARNING: ipi_ops should be defined with
DEFINE_DEBUGFS_ATTRIBUTE
drivers/cpuidle/test-cpuidle_latency.c:108:0-23: WARNING: timeout_ops should be defined
with DEFINE_DEBUGFS_ATTRIBUTE
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
CC: Pratik Rajesh Sampat <psampat(a)linux.ibm.com>
Reported-by: kernel test robot <lkp(a)intel.com>
Signed-off-by: kernel test robot <lkp(a)intel.com>
---
url:
https://github.com/0day-ci/linux/commits/Pratik-Rajesh-Sampat/CPU-Idle-la...
base:
https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git next
test-cpuidle_latency.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
--- a/drivers/cpuidle/test-cpuidle_latency.c
+++ b/drivers/cpuidle/test-cpuidle_latency.c
@@ -92,7 +92,7 @@ static int cpu_write_op(void *data, u64
run_smp_call_function_test(value);
return 0;
}
-DEFINE_SIMPLE_ATTRIBUTE(ipi_ops, cpu_read_op, cpu_write_op, "%llu\n");
+DEFINE_DEBUGFS_ATTRIBUTE(ipi_ops, cpu_read_op, cpu_write_op, "%llu\n");
static int timeout_read_op(void *data, u64 *timeout)
{
@@ -105,7 +105,8 @@ static int timeout_write_op(void *data,
run_timer_test(value);
return 0;
}
-DEFINE_SIMPLE_ATTRIBUTE(timeout_ops, timeout_read_op, timeout_write_op,
"%llu\n");
+DEFINE_DEBUGFS_ATTRIBUTE(timeout_ops, timeout_read_op, timeout_write_op,
+ "%llu\n");
static int __init latency_init(void)
{
@@ -116,11 +117,8 @@ static int __init latency_init(void)
pr_alert("latency_test: failed to create /sys/kernel/debug/latency_test\n");
return -1;
}
- temp = debugfs_create_file("ipi_cpu_dest",
- 0666,
- dir,
- NULL,
- &ipi_ops);
+ temp = debugfs_create_file_unsafe("ipi_cpu_dest", 0666, dir, NULL,
+ &ipi_ops);
if (!temp) {
pr_alert("latency_test: failed to create /sys/kernel/debug/ipi_cpu_dest\n");
return -1;
@@ -128,11 +126,8 @@ static int __init latency_init(void)
debugfs_create_u64("ipi_latency_ns", 0444, dir, &ipi_wakeup.latency_ns);
debugfs_create_u32("ipi_cpu_src", 0444, dir, &ipi_wakeup.src_cpu);
- temp = debugfs_create_file("timeout_expected_ns",
- 0666,
- dir,
- NULL,
- &timeout_ops);
+ temp = debugfs_create_file_unsafe("timeout_expected_ns", 0666, dir,
+ NULL, &timeout_ops);
if (!temp) {
pr_alert("latency_test: failed to create
/sys/kernel/debug/timeout_expected_ns\n");
return -1;