[PATCH] ftrace: Make ftrace_regs abstract from direct use

Christophe Leroy christophe.leroy at csgroup.eu
Mon Oct 7 23:24:22 PDT 2024



Le 08/10/2024 à 02:54, Steven Rostedt a écrit :
> On Mon, 7 Oct 2024 20:47:43 -0400
> Steven Rostedt <rostedt at goodmis.org> wrote:
> 
>> +#ifndef CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS
>> +struct __arch_ftrace_regs {
>> +	struct pt_regs		regs;
>> +};
>> +
>> +#define arch_ftrace_get_regs(fregs)					\
>> +	({ struct __arch_fregs_regs *__f = (struct __arch_ftrace_regs *)(fregs); \
>> +		&__f->regs;						\
>> +	})
> 
> I wrote the arch_ftrace_get_regs() at the start of creating this patch.
> 
>> +
>> +struct ftrace_regs;
>> +#define arch_ftrace_regs(fregs) ((struct __arch_ftrace_regs *)(fregs))
>> +
> 
> I just realized I can simplify it with:
> 
> #define arch_ftrace_get_regs(fregs)	({ &arch_ftrace_regs(fregs)->regs; })

Is it possible to write it as a static inline function to enforce type 
checking ?

> 
> I may send a v2 (tomorrow).
> 
> -- Steve



More information about the linux-riscv mailing list