Skip to contentSkip to conversation

LoongArch: KVM: Remove useless MODULE macro for MODULE_DEVICE_TABLE

PATCH In review Wentao Guan 4 participants 6 messages Apr 2, 2024 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 LoongArch: KVM: Remove useless MODULE macro for MODULE_DEVICE_TABLE

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

---
 arch/loongarch/kvm/main.c | 2 --
 1 file changed, 2 deletions(-)
arch/loongarch/kvm/main.c +0 -2
index 86a2f2d0cb27..7f2bd9a0814c 100644
@@ -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
Signature · 1 line
2.20.1
#1 lore raw

This should be Cc'ed to the KVM list.

Quoted 24 lines · Wentao Guan

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

---
 arch/loongarch/kvm/main.c | 2 --

 1 file changed, 2 deletions(-)
arch/loongarch/kvm/main.c +0 -0
index 86a2f2d0cb27..7f2bd9a0814c 100644
@@ -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

Signature · 2 lines
Xi Ruoyao <[email protected]>
School of Aerospace Science and Technology, Xidian University
#2 lore raw

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

maintainer
#3 lore raw
Quoted 3 lines · Wentao Guan

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

maintainer
#4 lore raw
In reply to Wentao Guan
Quoted 14 lines · Wentao Guan

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

---
  arch/loongarch/kvm/main.c | 2 --
  1 file changed, 2 deletions(-)
arch/loongarch/kvm/main.c +0 -0
index 86a2f2d0cb27..7f2bd9a0814c 100644

arch/loongarch/kvm/main.c static void kvm_loongarch_exit(void) · line 416

Quoted 8 lines
arch/loongarch/kvm/main.c +0 -1
@@ -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

Quoted 3 lines
arch/loongarch/kvm/main.c +0 -1
  MODULE_DEVICE_TABLE(cpu, kvm_feature);
-#endif

A message that is not in the archive (sent off-list or not yet received): [email protected]

maintainer
#6 lore raw
Quoted 5 lines · Wentao Guan

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

Quoted 4 lines

BRs
Wentao Guan