[PATCH 3/3] Create debugfs files for statistics
Cristian Marussi
cristian.marussi at arm.com
Mon Jul 1 09:19:58 PDT 2024
On Mon, Jul 01, 2024 at 03:28:51PM +0100, Luke Parkin wrote:
> Create debugfs files for the statistics in the scmi_debug_stats struct
>
> Signed-off-by: Luke Parkin <luke.parkin at arm.com>
> ---
> drivers/firmware/arm_scmi/driver.c | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
> index f69dff699d48..509ea42d17bf 100644
> --- a/drivers/firmware/arm_scmi/driver.c
> +++ b/drivers/firmware/arm_scmi/driver.c
> @@ -2884,7 +2884,7 @@ static void scmi_debugfs_common_cleanup(void *d)
> static struct scmi_debug_info *scmi_debugfs_common_setup(struct scmi_info *info)
> {
> char top_dir[16];
> - struct dentry *trans, *top_dentry;
> + struct dentry *trans, *top_dentry, *stats;
stats are conditional...so...
> struct scmi_debug_info *dbg;
> const char *c_ptr = NULL;
>
> @@ -2935,6 +2935,19 @@ static struct scmi_debug_info *scmi_debugfs_common_setup(struct scmi_info *info)
> debugfs_create_u32("rx_max_msg", 0400, trans,
> (u32 *)&info->rx_minfo.max_msg);
>
> + if (IS_ENABLED(CONFIG_ARM_SCMI_DEBUG_STATISTICS)) {
> + stats = debugfs_create_dir("stats", trans);
you can put the above local *stats var instead so that it is NOT even
defined when STATS=n
> + debugfs_create_atomic_t("response_ok", 0400, stats,
> + &info->stats.response_ok);
> + debugfs_create_atomic_t("dlyd_response_ok", 0400, stats,
> + &info->stats.dlyd_response_ok);
> + debugfs_create_atomic_t("sent_ok", 0400, stats,
> + &info->stats.sent_ok);
> + debugfs_create_atomic_t("sent_fail", 0400, stats,
> + &info->stats.sent_fail);
> + debugfs_create_atomic_t("xfers_response_timeout", 0400, stats,
> + &info->stats.xfers_response_timeout);
> + }
... moreover...this is not always enabled BUT certainly will be extend
sooner with more counters...so please split this setup out in a local helper
function.
Thanks,
Cristian
More information about the linux-arm-kernel
mailing list