[PATCH v2] RAS: Fix the trace_show() function to output trace_count

From: Tony Luck
Date: Wed Oct 05 2022 - 15:46:58 EST


The /sys/kernel/debug/ras/daemon_active file is used to indicate to some
kernel code whether there is a user mode consumer of RAS trace events
to decide whether to print to the console.

It looks like the intent was that reading the file would show the count
of tasks with the file open. But the code in the trace_show() function
is nonsense.

Add a seq_printf() to output the current value of the trace_count.

Fixes: d963cd95bea9 ("RAS, debugfs: Add debugfs interface for RAS subsystem")
Signed-off-by: Tony Luck <tony.luck@xxxxxxxxx>
---

V2: Updated commit description based on feedback from Boris

drivers/ras/debugfs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/ras/debugfs.c b/drivers/ras/debugfs.c
index 0d4f985afbf3..d67af5e08caf 100644
--- a/drivers/ras/debugfs.c
+++ b/drivers/ras/debugfs.c
@@ -15,7 +15,8 @@ EXPORT_SYMBOL_GPL(ras_userspace_consumers);

static int trace_show(struct seq_file *m, void *v)
{
- return atomic_read(&trace_count);
+ seq_printf(m, "%d\n", atomic_read(&trace_count));
+ return 0;
}

static int trace_open(struct inode *inode, struct file *file)
--
2.37.3