* [PATCH] tracing: Switch trace_recursion_record.c code over to use guard()
@ 2026-05-02 17:47 Yash Suthar
2026-05-12 14:41 ` Yash Suthar
0 siblings, 1 reply; 3+ messages in thread
From: Yash Suthar @ 2026-05-02 17:47 UTC (permalink / raw)
To: rostedt
Cc: mhiramat, mathieu.desnoyers, linux-kernel, linux-trace-kernel,
skhan, me, Yash Suthar
Switch mutex_lock()/mutex_unlock() to guard().
also drop the ret local variable and return directly.
Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>
---
kernel/trace/trace_recursion_record.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/kernel/trace/trace_recursion_record.c b/kernel/trace/trace_recursion_record.c
index 784fe1fbb866..bac4bc844ccd 100644
--- a/kernel/trace/trace_recursion_record.c
+++ b/kernel/trace/trace_recursion_record.c
@@ -180,9 +180,8 @@ static const struct seq_operations recursed_function_seq_ops = {
static int recursed_function_open(struct inode *inode, struct file *file)
{
- int ret = 0;
+ guard(mutex)(&recursed_function_lock);
- mutex_lock(&recursed_function_lock);
/* If this file was opened for write, then erase contents */
if ((file->f_mode & FMODE_WRITE) && (file->f_flags & O_TRUNC)) {
/* disable updating records */
@@ -194,10 +193,9 @@ static int recursed_function_open(struct inode *inode, struct file *file)
atomic_set(&nr_records, 0);
}
if (file->f_mode & FMODE_READ)
- ret = seq_open(file, &recursed_function_seq_ops);
- mutex_unlock(&recursed_function_lock);
+ return seq_open(file, &recursed_function_seq_ops);
- return ret;
+ return 0;
}
static ssize_t recursed_function_write(struct file *file,
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] tracing: Switch trace_recursion_record.c code over to use guard()
2026-05-02 17:47 [PATCH] tracing: Switch trace_recursion_record.c code over to use guard() Yash Suthar
@ 2026-05-12 14:41 ` Yash Suthar
2026-05-13 12:34 ` Steven Rostedt
0 siblings, 1 reply; 3+ messages in thread
From: Yash Suthar @ 2026-05-12 14:41 UTC (permalink / raw)
To: rostedt
Cc: mhiramat, mathieu.desnoyers, linux-kernel, linux-trace-kernel,
skhan, me
Gentle ping.
Sincerely,
Yash Suthar
On Sat, May 2, 2026 at 11:17 PM Yash Suthar <yashsuthar983@gmail.com> wrote:
>
> Switch mutex_lock()/mutex_unlock() to guard().
> also drop the ret local variable and return directly.
>
> Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>
> ---
> kernel/trace/trace_recursion_record.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/kernel/trace/trace_recursion_record.c b/kernel/trace/trace_recursion_record.c
> index 784fe1fbb866..bac4bc844ccd 100644
> --- a/kernel/trace/trace_recursion_record.c
> +++ b/kernel/trace/trace_recursion_record.c
> @@ -180,9 +180,8 @@ static const struct seq_operations recursed_function_seq_ops = {
>
> static int recursed_function_open(struct inode *inode, struct file *file)
> {
> - int ret = 0;
> + guard(mutex)(&recursed_function_lock);
>
> - mutex_lock(&recursed_function_lock);
> /* If this file was opened for write, then erase contents */
> if ((file->f_mode & FMODE_WRITE) && (file->f_flags & O_TRUNC)) {
> /* disable updating records */
> @@ -194,10 +193,9 @@ static int recursed_function_open(struct inode *inode, struct file *file)
> atomic_set(&nr_records, 0);
> }
> if (file->f_mode & FMODE_READ)
> - ret = seq_open(file, &recursed_function_seq_ops);
> - mutex_unlock(&recursed_function_lock);
> + return seq_open(file, &recursed_function_seq_ops);
>
> - return ret;
> + return 0;
> }
>
> static ssize_t recursed_function_write(struct file *file,
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tracing: Switch trace_recursion_record.c code over to use guard()
2026-05-12 14:41 ` Yash Suthar
@ 2026-05-13 12:34 ` Steven Rostedt
0 siblings, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2026-05-13 12:34 UTC (permalink / raw)
To: Yash Suthar
Cc: mhiramat, mathieu.desnoyers, linux-kernel, linux-trace-kernel,
skhan, me
On Tue, 12 May 2026 20:11:08 +0530
Yash Suthar <yashsuthar983@gmail.com> wrote:
> Gentle ping.
Hi,
What's the rush? This is just a clean up change. There's no feature here
that you need is there?
If you see it in patchwork[1], it's not lost. I just have other things
ahead of it. I usually process cleanup code last.
Thanks,
-- Steve
[1] https://patchwork.kernel.org/project/linux-trace-kernel/patch/20260502174741.39636-1-yashsuthar983@gmail.com/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-05-13 12:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-02 17:47 [PATCH] tracing: Switch trace_recursion_record.c code over to use guard() Yash Suthar
2026-05-12 14:41 ` Yash Suthar
2026-05-13 12:34 ` Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox