Message ID | e0782cdf680a645d7f8d311a16530be7004bb0ef.1718908016.git.naveen@kernel.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | powerpc: Add support for ftrace direct and BPF trampolines | expand |
On Fri Jun 21, 2024 at 4:54 AM AEST, Naveen N Rao wrote: > Minor refactor for converting #ifdef to IS_ENABLED(). > > Signed-off-by: Naveen N Rao <naveen@kernel.org> > --- > arch/powerpc/kernel/module_64.c | 11 +++++------ > 1 file changed, 5 insertions(+), 6 deletions(-) > > diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c > index e9bab599d0c2..c202be11683b 100644 > --- a/arch/powerpc/kernel/module_64.c > +++ b/arch/powerpc/kernel/module_64.c > @@ -241,14 +241,13 @@ static unsigned long get_stubs_size(const Elf64_Ehdr *hdr, > } > } > > -#ifdef CONFIG_DYNAMIC_FTRACE > /* make the trampoline to the ftrace_caller */ > - relocs++; > -#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS > + if (IS_ENABLED(CONFIG_DYNAMIC_FTRACE)) > + relocs++; > + > /* an additional one for ftrace_regs_caller */ > - relocs++; > -#endif > -#endif > + if (IS_ENABLED(CONFIG_DYNAMIC_FTRACE_WITH_REGS)) > + relocs++; > > pr_debug("Looks like a total of %lu stubs, max\n", relocs); > return relocs * sizeof(struct ppc64_stub_entry); LGTM. Hmm, you could get even cleverer // make the trampoline to the ftrace_caller and ftrace_regs_caller relocs += IS_ENABLED(CONFIG_DYNAMIC_FTRACE) + IS_ENABLED(CONFIG_DYNAMIC_FTRACE_WITH_REGS); But either way Reviewed-by: Nicholas Piggin <npiggin@gmail.com> Thanks, Nick
diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c index e9bab599d0c2..c202be11683b 100644 --- a/arch/powerpc/kernel/module_64.c +++ b/arch/powerpc/kernel/module_64.c @@ -241,14 +241,13 @@ static unsigned long get_stubs_size(const Elf64_Ehdr *hdr, } } -#ifdef CONFIG_DYNAMIC_FTRACE /* make the trampoline to the ftrace_caller */ - relocs++; -#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS + if (IS_ENABLED(CONFIG_DYNAMIC_FTRACE)) + relocs++; + /* an additional one for ftrace_regs_caller */ - relocs++; -#endif -#endif + if (IS_ENABLED(CONFIG_DYNAMIC_FTRACE_WITH_REGS)) + relocs++; pr_debug("Looks like a total of %lu stubs, max\n", relocs); return relocs * sizeof(struct ppc64_stub_entry);
Minor refactor for converting #ifdef to IS_ENABLED(). Signed-off-by: Naveen N Rao <naveen@kernel.org> --- arch/powerpc/kernel/module_64.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)