platform-driver-x86.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] platform/x86: dell-wmi-sysman/think-lmi: Make fw_attr_class global static
@ 2021-06-09 14:59 Hans de Goede
  2021-06-09 15:25 ` [External] " Mark Pearson
  2021-06-09 15:31 ` Nathan Chancellor
  0 siblings, 2 replies; 3+ messages in thread
From: Hans de Goede @ 2021-06-09 14:59 UTC (permalink / raw)
  To: Mark Gross, Andy Shevchenko
  Cc: Hans de Goede, platform-driver-x86, Mark Pearson,
	Dell.Client.Kernel, Nathan Chancellor

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.

Cc: Mark Pearson <markpearson@lenovo.com>
Cc: Dell.Client.Kernel@dell.com
Reported-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/platform/x86/dell/dell-wmi-sysman/sysman.c | 2 +-
 drivers/platform/x86/think-lmi.c                   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
index 1378c1878658..636bdfa83284 100644
--- a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
+++ b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
@@ -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;
 
 
 /**
diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c
index 782d8e3fe7a1..c6413b906e4a 100644
--- a/drivers/platform/x86/think-lmi.c
+++ b/drivers/platform/x86/think-lmi.c
@@ -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 */
-- 
2.31.1


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

* Re: [External] [PATCH] platform/x86: dell-wmi-sysman/think-lmi: Make fw_attr_class global static
  2021-06-09 14:59 [PATCH] platform/x86: dell-wmi-sysman/think-lmi: Make fw_attr_class global static Hans de Goede
@ 2021-06-09 15:25 ` Mark Pearson
  2021-06-09 15:31 ` Nathan Chancellor
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Pearson @ 2021-06-09 15:25 UTC (permalink / raw)
  To: Hans de Goede, Mark Gross, Andy Shevchenko
  Cc: platform-driver-x86, Dell.Client.Kernel, Nathan Chancellor

Thanks Hans - I should have caught that.

Looks good

On 2021-06-09 10:59 a.m., Hans de Goede wrote:
> 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.
> 
> Cc: Mark Pearson <markpearson@lenovo.com>
> Cc: Dell.Client.Kernel@dell.com
> Reported-by: Nathan Chancellor <nathan@kernel.org>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/platform/x86/dell/dell-wmi-sysman/sysman.c | 2 +-
>  drivers/platform/x86/think-lmi.c                   | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
> index 1378c1878658..636bdfa83284 100644
> --- a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
> +++ b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
> @@ -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;
>  
>  
>  /**
> diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c
> index 782d8e3fe7a1..c6413b906e4a 100644
> --- a/drivers/platform/x86/think-lmi.c
> +++ b/drivers/platform/x86/think-lmi.c
> @@ -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 */
> 

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

* Re: [PATCH] platform/x86: dell-wmi-sysman/think-lmi: Make fw_attr_class global static
  2021-06-09 14:59 [PATCH] platform/x86: dell-wmi-sysman/think-lmi: Make fw_attr_class global static Hans de Goede
  2021-06-09 15:25 ` [External] " Mark Pearson
@ 2021-06-09 15:31 ` Nathan Chancellor
  1 sibling, 0 replies; 3+ messages in thread
From: Nathan Chancellor @ 2021-06-09 15:31 UTC (permalink / raw)
  To: Hans de Goede, Mark Gross, Andy Shevchenko
  Cc: platform-driver-x86, Mark Pearson, Dell.Client.Kernel

On 6/9/2021 7:59 AM, Hans de Goede wrote:
> 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 :)

> Cc: Mark Pearson <markpearson@lenovo.com>
> Cc: Dell.Client.Kernel@dell.com
> Reported-by: Nathan Chancellor <nathan@kernel.org>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> ---
>   drivers/platform/x86/dell/dell-wmi-sysman/sysman.c | 2 +-
>   drivers/platform/x86/think-lmi.c                   | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
> index 1378c1878658..636bdfa83284 100644
> --- a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
> +++ b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
> @@ -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;
>   
>   
>   /**
> diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c
> index 782d8e3fe7a1..c6413b906e4a 100644
> --- a/drivers/platform/x86/think-lmi.c
> +++ b/drivers/platform/x86/think-lmi.c
> @@ -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 */
> 

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

end of thread, other threads:[~2021-06-09 15:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-09 14:59 [PATCH] platform/x86: dell-wmi-sysman/think-lmi: Make fw_attr_class global static Hans de Goede
2021-06-09 15:25 ` [External] " Mark Pearson
2021-06-09 15:31 ` Nathan Chancellor

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 NNTP newsgroup(s).