From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============1000297044002519696==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] cpuidle: fix debugfs_simple_attr.cocci warnings Date: Fri, 02 Apr 2021 17:03:12 +0800 Message-ID: <20210402090312.GA44807@3c0841b5523d> In-Reply-To: <202104021627.qFtgFvAz-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============1000297044002519696== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable CC: kbuild-all(a)lists.01.org In-Reply-To: <20210401114504.13466-2-psampat@linux.ibm.com> References: <20210401114504.13466-2-psampat@linux.ibm.com> TO: Pratik Rajesh Sampat 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/cpuid= le-Extract-IPI-based-and-timer-based-wakeup-latency-from-idle-states/202104= 02-015842 base: https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselfte= st.git next :::::: branch date: 15 hours ago :::::: commit date: 15 hours ago Please take the patch only if it's a positive warning. Thanks! 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; --===============1000297044002519696==--