Re: [PATCH v3 5/8] riscv: mark some code and data as file-static
From: Greentime Hu
Date: Wed Oct 23 2019 - 01:47:07 EST
Paul Walmsley <paul.walmsley@xxxxxxxxxx> æ 2019å10æ19æ éå äå3:58åéï
>
> Several functions and arrays which are only used in the files in which
> they are declared are missing "static" qualifiers. Warnings for these
> symbols are reported by sparse:
>
> arch/riscv/kernel/stacktrace.c:22:14: warning: symbol 'walk_stackframe' was not declared. Should it be static?
> arch/riscv/kernel/vdso.c:28:18: warning: symbol 'vdso_data' was not declared. Should it be static?
> arch/riscv/mm/init.c:42:6: warning: symbol 'setup_zero_page' was not declared. Should it be static?
> arch/riscv/mm/init.c:152:7: warning: symbol 'fixmap_pte' was not declared. Should it be static?
> arch/riscv/mm/init.c:211:7: warning: symbol 'trampoline_pmd' was not declared. Should it be static?
> arch/riscv/mm/init.c:212:7: warning: symbol 'fixmap_pmd' was not declared. Should it be static?
> arch/riscv/mm/init.c:219:7: warning: symbol 'early_pmd' was not declared. Should it be static?
> arch/riscv/mm/sifive_l2_cache.c:145:12: warning: symbol 'sifive_l2_init' was not declared. Should it be static?
>
> Resolve these warnings by marking them as static.
>
> Signed-off-by: Paul Walmsley <paul.walmsley@xxxxxxxxxx>
> ---
> arch/riscv/kernel/stacktrace.c | 6 ++++--
> arch/riscv/kernel/vdso.c | 2 +-
> arch/riscv/mm/init.c | 12 +++++++-----
> arch/riscv/mm/sifive_l2_cache.c | 2 +-
> 4 files changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/arch/riscv/kernel/stacktrace.c b/arch/riscv/kernel/stacktrace.c
> index 0940681d2f68..fd908baed51c 100644
> --- a/arch/riscv/kernel/stacktrace.c
> +++ b/arch/riscv/kernel/stacktrace.c
> @@ -19,8 +19,10 @@ struct stackframe {
> unsigned long ra;
> };
>
> -void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs,
> - bool (*fn)(unsigned long, void *), void *arg)
> +static void notrace walk_stackframe(struct task_struct *task,
> + struct pt_regs *regs,
> + bool (*fn)(unsigned long, void *),
> + void *arg)
I think walk_stackframe() could not be static because it will be used
in perf_callchain.c.