Skip to contentSkip to conversation

platform/x86: dell-wmi-sysman/think-lmi: Make fw_attr_class global static

PATCH In review Hans de Goede 3 participants 3 messages Jun 9, 2021

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

PATCH 1/1 platform/x86: dell-wmi-sysman/think-lmi: Make fw_attr_class global static

The dell-wmi-sysman and think-lmi kernel modules both have a global struct class *fw_attr_class variable, leading to the following compile errors when both are builtin:

ld: drivers/platform/x86/think-lmi.o:(.bss+0x0): multiple definition of `fw_attr_class'; drivers/platform/x86/dell/dell-wmi-sysman/sysman.o:(.bss+0x0): first defined here

In both cases the variable is only used in the file where it is declared. Make both declarations static to avoid the linker error.

---
 drivers/platform/x86/dell/dell-wmi-sysman/sysman.c | 2 +-
 drivers/platform/x86/think-lmi.c                   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/dell/dell-wmi-sysman/sysman.c +1 -1
index 1378c1878658..636bdfa83284 100644
@@ -25,7 +25,7 @@ struct wmi_sysman_priv wmi_priv = {
 /* reset bios to defaults */
 static const char * const reset_types[] = {"builtinsafe", "lastknowngood", "factory", "custom"};
 static int reset_option = -1;
-struct class *fw_attr_class;
+static struct class *fw_attr_class;
 
 
 /**
drivers/platform/x86/think-lmi.c +1 -1
index 782d8e3fe7a1..c6413b906e4a 100644
@@ -134,7 +134,7 @@ static const char * const encoding_options[] = {
 	[TLMI_ENCODING_SCANCODE] = "scancode",
 };
 static struct think_lmi tlmi_priv;
-struct class *fw_attr_class;
+static struct class *fw_attr_class;
 
 /* ------ Utility functions ------------*/
 /* Convert BIOS WMI error string to suitable error code */
Signature · 1 line
2.31.1
#1 lore raw

Thanks Hans - I should have caught that.

Looks good

Quoted 45 lines · Hans de Goede

The dell-wmi-sysman and think-lmi kernel modules both have a global struct class *fw_attr_class variable, leading to the following compile errors when both are builtin:

ld: drivers/platform/x86/think-lmi.o:(.bss+0x0): multiple definition of `fw_attr_class'; drivers/platform/x86/dell/dell-wmi-sysman/sysman.o:(.bss+0x0): first defined here

In both cases the variable is only used in the file where it is declared. Make both declarations static to avoid the linker error.

---
 drivers/platform/x86/dell/dell-wmi-sysman/sysman.c | 2 +-
 drivers/platform/x86/think-lmi.c                   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/dell/dell-wmi-sysman/sysman.c +1 -1
index 1378c1878658..636bdfa83284 100644
@@ -25,7 +25,7 @@ struct wmi_sysman_priv wmi_priv = {
 /* reset bios to defaults */
 static const char * const reset_types[] = {"builtinsafe", "lastknowngood", "factory", "custom"};
 static int reset_option = -1;
-struct class *fw_attr_class;
+static struct class *fw_attr_class;
 
 
 /**
drivers/platform/x86/think-lmi.c +1 -1
index 782d8e3fe7a1..c6413b906e4a 100644
@@ -134,7 +134,7 @@ static const char * const encoding_options[] = {
 	[TLMI_ENCODING_SCANCODE] = "scancode",
 };
 static struct think_lmi tlmi_priv;
-struct class *fw_attr_class;
+static struct class *fw_attr_class;
 
 /* ------ Utility functions ------------*/
 /* Convert BIOS WMI error string to suitable error code */
Reviewed-by on v1 1/1
#2 lore raw
In reply to Hans de Goede
Quoted 8 lines · Hans de Goede

The dell-wmi-sysman and think-lmi kernel modules both have a global struct class *fw_attr_class variable, leading to the following compile errors when both are builtin:

ld: drivers/platform/x86/think-lmi.o:(.bss+0x0): multiple definition of `fw_attr_class'; drivers/platform/x86/dell/dell-wmi-sysman/sysman.o:(.bss+0x0): first defined here

In both cases the variable is only used in the file where it is declared. Make both declarations static to avoid the linker error.

I figured that would be the solution but I was not sure, hence just the report rather than this patch :)

Quoted 4 lines
Quoted 32 lines
---
  drivers/platform/x86/dell/dell-wmi-sysman/sysman.c | 2 +-
  drivers/platform/x86/think-lmi.c                   | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/dell/dell-wmi-sysman/sysman.c +1 -1
index 1378c1878658..636bdfa83284 100644
@@ -25,7 +25,7 @@ struct wmi_sysman_priv wmi_priv = {
  /* reset bios to defaults */
  static const char * const reset_types[] = {"builtinsafe", "lastknowngood", "factory", "custom"};
  static int reset_option = -1;
-struct class *fw_attr_class;
+static struct class *fw_attr_class;
 
 
  /**
drivers/platform/x86/think-lmi.c +1 -1
index 782d8e3fe7a1..c6413b906e4a 100644
@@ -134,7 +134,7 @@ static const char * const encoding_options[] = {
  	[TLMI_ENCODING_SCANCODE] = "scancode",
  };
  static struct think_lmi tlmi_priv;
-struct class *fw_attr_class;
+static struct class *fw_attr_class;
 
  /* ------ Utility functions ------------*/
  /* Convert BIOS WMI error string to suitable error code */