loongarch.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] LoongArch: KVM: Remove useless MODULE macro for MODULE_DEVICE_TABLE
@ 2024-04-02 10:39 Wentao Guan
  2024-04-02 10:43 ` Xi Ruoyao
  2024-04-02 11:21 ` maobibo
  0 siblings, 2 replies; 6+ messages in thread
From: Wentao Guan @ 2024-04-02 10:39 UTC (permalink / raw
  To: zhaotianrui; +Cc: loongarch, linux-kernel, Wentao Guan, Yuli Wang

MODULE_DEVICE_TABLE use ifdef MODULE macro in module.h,
just clean it up.

Suggested-by: Yuli Wang <wangyuli@uniontech.com>
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
---
 arch/loongarch/kvm/main.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/loongarch/kvm/main.c b/arch/loongarch/kvm/main.c
index 86a2f2d0cb27..7f2bd9a0814c 100644
--- a/arch/loongarch/kvm/main.c
+++ b/arch/loongarch/kvm/main.c
@@ -410,10 +410,8 @@ static void kvm_loongarch_exit(void)
 module_init(kvm_loongarch_init);
 module_exit(kvm_loongarch_exit);
 
-#ifdef MODULE
 static const struct cpu_feature kvm_feature[] = {
 	{ .feature = cpu_feature(LOONGARCH_LVZ) },
 	{},
 };
 MODULE_DEVICE_TABLE(cpu, kvm_feature);
-#endif
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] LoongArch: KVM: Remove useless MODULE macro for MODULE_DEVICE_TABLE
  2024-04-02 10:39 [PATCH] LoongArch: KVM: Remove useless MODULE macro for MODULE_DEVICE_TABLE Wentao Guan
@ 2024-04-02 10:43 ` Xi Ruoyao
  2024-04-02 10:45   ` Wentao Guan
  2024-04-02 11:21 ` maobibo
  1 sibling, 1 reply; 6+ messages in thread
From: Xi Ruoyao @ 2024-04-02 10:43 UTC (permalink / raw
  To: Wentao Guan, zhaotianrui; +Cc: loongarch, linux-kernel, Yuli Wang, kvm

This should be Cc'ed to the KVM list.

On Tue, 2024-04-02 at 18:39 +0800, Wentao Guan wrote:
> MODULE_DEVICE_TABLE use ifdef MODULE macro in module.h,
> just clean it up.
> 
> Suggested-by: Yuli Wang <wangyuli@uniontech.com>
> Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
> ---
>  arch/loongarch/kvm/main.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/arch/loongarch/kvm/main.c b/arch/loongarch/kvm/main.c
> index 86a2f2d0cb27..7f2bd9a0814c 100644
> --- a/arch/loongarch/kvm/main.c
> +++ b/arch/loongarch/kvm/main.c
> @@ -410,10 +410,8 @@ static void kvm_loongarch_exit(void)
>  module_init(kvm_loongarch_init);
>  module_exit(kvm_loongarch_exit);
>  
> -#ifdef MODULE
>  static const struct cpu_feature kvm_feature[] = {
>  	{ .feature = cpu_feature(LOONGARCH_LVZ) },
>  	{},
>  };
>  MODULE_DEVICE_TABLE(cpu, kvm_feature);
> -#endif

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] LoongArch: KVM: Remove useless MODULE macro for MODULE_DEVICE_TABLE
  2024-04-02 10:43 ` Xi Ruoyao
@ 2024-04-02 10:45   ` Wentao Guan
  2024-04-02 14:39     ` Huacai Chen
  0 siblings, 1 reply; 6+ messages in thread
From: Wentao Guan @ 2024-04-02 10:45 UTC (permalink / raw
  To: Xi Ruoyao, zhaotianrui
  Cc: loongarch, linux-kernel, 王昱力, kvm

OK, it will resend in PATCH V2.
I have a mistake to not add "__maybe_unused" in cpu_feature structure.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] LoongArch: KVM: Remove useless MODULE macro for MODULE_DEVICE_TABLE
  2024-04-02 10:39 [PATCH] LoongArch: KVM: Remove useless MODULE macro for MODULE_DEVICE_TABLE Wentao Guan
  2024-04-02 10:43 ` Xi Ruoyao
@ 2024-04-02 11:21 ` maobibo
       [not found]   ` <tencent_0ED20EAF678A7C93309EA4F6@qq.com>
  1 sibling, 1 reply; 6+ messages in thread
From: maobibo @ 2024-04-02 11:21 UTC (permalink / raw
  To: Wentao Guan, zhaotianrui; +Cc: loongarch, linux-kernel, Yuli Wang



On 2024/4/2 下午6:39, Wentao Guan wrote:
> MODULE_DEVICE_TABLE use ifdef MODULE macro in module.h,
> just clean it up.
> 
> Suggested-by: Yuli Wang <wangyuli@uniontech.com>
> Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
> ---
>   arch/loongarch/kvm/main.c | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/arch/loongarch/kvm/main.c b/arch/loongarch/kvm/main.c
> index 86a2f2d0cb27..7f2bd9a0814c 100644
> --- a/arch/loongarch/kvm/main.c
> +++ b/arch/loongarch/kvm/main.c
> @@ -410,10 +410,8 @@ static void kvm_loongarch_exit(void)
>   module_init(kvm_loongarch_init);
>   module_exit(kvm_loongarch_exit);
>   
> -#ifdef MODULE
>   static const struct cpu_feature kvm_feature[] = {
>   	{ .feature = cpu_feature(LOONGARCH_LVZ) },
>   	{},
>   };
Wentao,

Thanks for your patch, there is static variable kvm_feature
which is embraced by macro MODULE also :-), besides MODULE_DEVICE_TABLE.

Regards
Bibo Mao
>   MODULE_DEVICE_TABLE(cpu, kvm_feature);
> -#endif
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] LoongArch: KVM: Remove useless MODULE macro for MODULE_DEVICE_TABLE
       [not found]   ` <tencent_0ED20EAF678A7C93309EA4F6@qq.com>
@ 2024-04-02 13:06     ` maobibo
  0 siblings, 0 replies; 6+ messages in thread
From: maobibo @ 2024-04-02 13:06 UTC (permalink / raw
  To: Wentao Guan, zhaotianrui
  Cc: loongarch, linux-kernel, 王昱力



On 2024/4/2 下午8:47, Wentao Guan wrote:
> Hello,Bibo,
> 
> I change this that we see other guys use "MODULE_DEVICE_TABLE(cpu,..."
> without use that MODULE macro,and mark cpu_feature struct "__maybe_unused",
> do the same way to avoid unused variable compiler warning  :).

yeap, it looks good to me with __maybe_unused added.

Regards
Bibo Mao
> 
> BRs
> Wentao Guan
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] LoongArch: KVM: Remove useless MODULE macro for MODULE_DEVICE_TABLE
  2024-04-02 10:45   ` Wentao Guan
@ 2024-04-02 14:39     ` Huacai Chen
  0 siblings, 0 replies; 6+ messages in thread
From: Huacai Chen @ 2024-04-02 14:39 UTC (permalink / raw
  To: Wentao Guan
  Cc: Xi Ruoyao, zhaotianrui, loongarch, linux-kernel,
	王昱力, kvm

On Tue, Apr 2, 2024 at 6:46 PM Wentao Guan <guanwentao@uniontech.com> wrote:
>
> OK, it will resend in PATCH V2.
> I have a mistake to not add "__maybe_unused" in cpu_feature structure.

__maybe_unused is not encouraged unless there is no other solution, in
this case it is better to keep the old style, which is the same as
vmx.c and svm.c in x86.

Huacai

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-04-02 14:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-02 10:39 [PATCH] LoongArch: KVM: Remove useless MODULE macro for MODULE_DEVICE_TABLE Wentao Guan
2024-04-02 10:43 ` Xi Ruoyao
2024-04-02 10:45   ` Wentao Guan
2024-04-02 14:39     ` Huacai Chen
2024-04-02 11:21 ` maobibo
     [not found]   ` <tencent_0ED20EAF678A7C93309EA4F6@qq.com>
2024-04-02 13:06     ` maobibo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).