[PATCH] platform/x86: lenovo: gamezone needs "other mode"

Arnd Bergmann posted 1 patch 2 months, 4 weeks ago
drivers/platform/x86/lenovo/Kconfig | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[PATCH] platform/x86: lenovo: gamezone needs "other mode"
Posted by Arnd Bergmann 2 months, 4 weeks ago
From: Arnd Bergmann <arnd@arndb.de>

Registering the "other mode" notifier fails if that is disabled:

x86_64-linux-ld: drivers/platform/x86/lenovo/wmi-gamezone.o: in function `lwmi_gz_probe':
wmi-gamezone.c:(.text+0x336): undefined reference to `devm_lwmi_om_register_notifier'

This could be fixed by adding a stub helper, but a Kconfig 'select'
seems simpler here.

Fixes: 22024ac5366f ("platform/x86: Add Lenovo Gamezone WMI Driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/platform/x86/lenovo/Kconfig | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/platform/x86/lenovo/Kconfig b/drivers/platform/x86/lenovo/Kconfig
index b76157b35296..e9e1c3268373 100644
--- a/drivers/platform/x86/lenovo/Kconfig
+++ b/drivers/platform/x86/lenovo/Kconfig
@@ -250,8 +250,7 @@ config LENOVO_WMI_GAMEZONE
 	depends on ACPI_WMI
 	depends on DMI
 	select ACPI_PLATFORM_PROFILE
-	select LENOVO_WMI_EVENTS
-	select LENOVO_WMI_HELPERS
+	select LENOVO_WMI_TUNING
 	help
 	  Say Y here if you have a WMI aware Lenovo Legion device and would like to use the
 	  platform-profile firmware interface to manage power usage.
-- 
2.39.5
Re: [PATCH] platform/x86: lenovo: gamezone needs "other mode"
Posted by Ilpo Järvinen 2 months, 3 weeks ago
On Wed, 9 Jul 2025, Arnd Bergmann wrote:

> From: Arnd Bergmann <arnd@arndb.de>
> 
> Registering the "other mode" notifier fails if that is disabled:
> 
> x86_64-linux-ld: drivers/platform/x86/lenovo/wmi-gamezone.o: in function `lwmi_gz_probe':
> wmi-gamezone.c:(.text+0x336): undefined reference to `devm_lwmi_om_register_notifier'
> 
> This could be fixed by adding a stub helper, but a Kconfig 'select'
> seems simpler here.
> 
> Fixes: 22024ac5366f ("platform/x86: Add Lenovo Gamezone WMI Driver")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/platform/x86/lenovo/Kconfig | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/platform/x86/lenovo/Kconfig b/drivers/platform/x86/lenovo/Kconfig
> index b76157b35296..e9e1c3268373 100644
> --- a/drivers/platform/x86/lenovo/Kconfig
> +++ b/drivers/platform/x86/lenovo/Kconfig
> @@ -250,8 +250,7 @@ config LENOVO_WMI_GAMEZONE
>  	depends on ACPI_WMI
>  	depends on DMI
>  	select ACPI_PLATFORM_PROFILE
> -	select LENOVO_WMI_EVENTS
> -	select LENOVO_WMI_HELPERS
> +	select LENOVO_WMI_TUNING

Why did you remove the other two?

Do select propagate properly these days across another select? I was under 
impression they don't which is one of the reasons use of select is 
discouraged.

-- 
 i.
Re: [PATCH] platform/x86: lenovo: gamezone needs "other mode"
Posted by Arnd Bergmann 2 months, 3 weeks ago
On Fri, Jul 11, 2025, at 16:55, Ilpo Järvinen wrote:
> On Wed, 9 Jul 2025, Arnd Bergmann wrote:
>> index b76157b35296..e9e1c3268373 100644
>> --- a/drivers/platform/x86/lenovo/Kconfig
>> +++ b/drivers/platform/x86/lenovo/Kconfig
>> @@ -250,8 +250,7 @@ config LENOVO_WMI_GAMEZONE
>>  	depends on ACPI_WMI
>>  	depends on DMI
>>  	select ACPI_PLATFORM_PROFILE
>> -	select LENOVO_WMI_EVENTS
>> -	select LENOVO_WMI_HELPERS
>> +	select LENOVO_WMI_TUNING
>
> Why did you remove the other two?
>
> Do select propagate properly these days across another select?

Yes, as far as I know it has always done this, with the one
exception that it does not propagate when trying to select
another symbol that has missing dependencies

> I was under impression they don't which is one of the reasons
> use of select is discouraged.

I have seen that mentioned before in commit logs, but I
think this was a misunderstanding. Using 'select' is still
discouraged, but for other reasons:

- complexity quickly gets out of hand when selecting something
  that has other dependencies, as the driver selecting them
  must duplicate all those dependencies and keep them in sync

- mixing 'depends on' and 'select' for the same dependency
  in different drivers tends to cause dependency loops

- selecting user-visible symbols has side-effects if another
  symbol depends on that, e.g. the "select I2C" in some subsystems
  causes the I2C submenu to appear.

    Arnd
Re: [PATCH] platform/x86: lenovo: gamezone needs "other mode"
Posted by Ilpo Järvinen 2 months, 3 weeks ago
On Fri, 11 Jul 2025, Arnd Bergmann wrote:

> On Fri, Jul 11, 2025, at 16:55, Ilpo Järvinen wrote:
> > On Wed, 9 Jul 2025, Arnd Bergmann wrote:
> >> index b76157b35296..e9e1c3268373 100644
> >> --- a/drivers/platform/x86/lenovo/Kconfig
> >> +++ b/drivers/platform/x86/lenovo/Kconfig
> >> @@ -250,8 +250,7 @@ config LENOVO_WMI_GAMEZONE
> >>  	depends on ACPI_WMI
> >>  	depends on DMI
> >>  	select ACPI_PLATFORM_PROFILE
> >> -	select LENOVO_WMI_EVENTS
> >> -	select LENOVO_WMI_HELPERS
> >> +	select LENOVO_WMI_TUNING
> >
> > Why did you remove the other two?
> >
> > Do select propagate properly these days across another select?
> 
> Yes, as far as I know it has always done this, with the one
> exception that it does not propagate when trying to select
> another symbol that has missing dependencies
> 
> > I was under impression they don't which is one of the reasons
> > use of select is discouraged.
> 
> I have seen that mentioned before in commit logs, but I
> think this was a misunderstanding. Using 'select' is still
> discouraged, but for other reasons:
> 
> - complexity quickly gets out of hand when selecting something
>   that has other dependencies, as the driver selecting them
>   must duplicate all those dependencies and keep them in sync

Okay, thanks for these clarifications.

I think I'll take this patch but change it to still keep the other selects 
as wmi-gamezone.c is directly using those too anyway.

> - mixing 'depends on' and 'select' for the same dependency
>   in different drivers tends to cause dependency loops
> 
> - selecting user-visible symbols has side-effects if another
>   symbol depends on that, e.g. the "select I2C" in some subsystems
>   causes the I2C submenu to appear.
> 
>     Arnd
> 

-- 
 i.
Re: [PATCH] platform/x86: lenovo: gamezone needs "other mode"
Posted by Arnd Bergmann 2 months, 3 weeks ago
On Fri, Jul 11, 2025, at 17:34, Ilpo Järvinen wrote:
> On Fri, 11 Jul 2025, Arnd Bergmann wrote:

> I think I'll take this patch but change it to still keep the other selects 
> as wmi-gamezone.c is directly using those too anyway.

Sounds good to me, thanks!

   Arnd