From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============1340926589683227730==" MIME-Version: 1.0 From: kernel test robot To: kbuild-all@lists.01.org Subject: [PATCH] cpuidle: fix debugfs_simple_attr.cocci warnings Date: Tue, 16 Mar 2021 06:44:54 +0800 Message-ID: <20210315224454.GA33967@2bb5f4305114> In-Reply-To: <20210315114827.46036-2-psampat@linux.ibm.com> List-Id: --===============1340926589683227730== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: kernel test robot 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 shoul= d 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 Reported-by: kernel test robot Signed-off-by: kernel test robot --- url: https://github.com/0day-ci/linux/commits/Pratik-Rajesh-Sampat/CPU-I= dle-latency-selftest-framework/20210315-195036 base: https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselfte= st.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 =3D debugfs_create_file("ipi_cpu_dest", - 0666, - dir, - NULL, - &ipi_ops); + temp =3D 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 =3D debugfs_create_file("timeout_expected_ns", - 0666, - dir, - NULL, - &timeout_ops); + temp =3D 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_expec= ted_ns\n"); return -1; --===============1340926589683227730==--