[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3019eada-7496-ca11-b645-f5efd7d215f4@loongson.cn>
Date: Fri, 11 Apr 2025 10:47:11 +0800
From: Tiezhu Yang <yangtiezhu@...ngson.cn>
To: Wentao Guan <guanwentao@...ontech.com>
Cc: chenhuacai@...nel.org, linux-kernel@...r.kernel.org,
loongarch@...ts.linux.dev
Subject: Re: [PATCH] LoongArch: Handle fp, lsx, lasx and lbt assembly symbols
On 04/09/2025 12:12 AM, Wentao Guan wrote:
> Hello Yang,
>
> I don`t know why change it defination remove "asmlinkage",
> why not explain it in commit message?
$ grep -rnw "define asmlinkage" .
./arch/x86/include/asm/linkage.h:20:#define asmlinkage CPP_ASMLINKAGE
__attribute__((regparm(0)))
./include/linux/linkage.h:22:#define asmlinkage CPP_ASMLINKAGE
include/linux/linkage.h
#ifdef __cplusplus
#define CPP_ASMLINKAGE extern "C"
#else
#define CPP_ASMLINKAGE
#endif
#ifndef asmlinkage
#define asmlinkage CPP_ASMLINKAGE
#endif
So for LoongArch, asmlinkage means extern "C" or NULL, there is no
need to use asmlinkage for these prototypes because they are not put
in uapi headers, that is to say, they will be called and built only
by C compiler rather than C++ compiler, so asmlinkage is actually
NULL in this case.
Furthermore, there are no asmlinkage for the other exist prototypes
such as _save_fp, _restore_fp in arch/loongarch/include/asm/fpu.h,
so in my opinion, just keep them consistent.
But according to Documentation/process/coding-style.rst, it seems
asmlinkage should be used.
"Large, non-trivial assembly functions should go in .S files, with
corresponding
C prototypes defined in C header files. The C prototypes for assembly
functions should use ``asmlinkage``."
There are two ways:
(1) no need to use asmlinkage for these new added prototypes for
assembly functions in asm/fpu.h and asm/lbt.h to keep consistent.
(2) use asmlinkage for these new added prototypes for assembly functions
in asm/fpu.h and asm/lbt.h according to Documentation, and then add
asmlinkage for the other exist prototypes if necessary.
That's up to the arch maintainer Huacai.
Thanks,
Tiezhu
Powered by blists - more mailing lists