platform/x86: asus-wmi: fix build without CONFIG_SUSPEND
Luke Jones
maintainercover platform/x86: asus-wmi: fix build without CONFIG_SUSPEND
Fixes "platform/x86: asus-wmi: Refactor Ally suspend/resume".
Verified using the following details provided by test robot:
tree: https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git review-ilpo-next head: 83579675331059689e2869bf752ca9e17fadbd82 commit: feea7bd6b02d43a794e3f065650d89cf8d8e8e59 [74/89] platform/x86: asus-wmi: Refactor Ally suspend/resume config: x86_64-buildonly-randconfig-004-20250509 (https://download.01.org/0day-ci/archive/20250509/[email protected]/config) compiler: clang version 20.1.2 (https://github.com/llvm/llvm-project 58df0ef89dd64126512e4ee27b4ac3fd8ddf6247) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250509/[email protected]/reproduce)
I've not done anything fancy here and left asus_hotk_prepare() as is, as it is *incredibly* unlikely anyone would ever run a ROG Ally without suspend enabled.
Luke Jones (1):
platform/x86: asus-wmi: fix build without CONFIG_SUSPEND
drivers/platform/x86/asus-wmi.c | 9 +++++++++ 1 file changed, 9 insertions(+)
Signature · 1 line
2.49.0
Luke Jones
maintainerPATCH 1/1 platform/x86: asus-wmi: fix build without CONFIG_SUSPEND
The patch "Refactor Ally suspend/resume" introduced an acpi_s2idle_dev_ops for use with ROG Ally which caused a build error if CONFIG_SUSPEND was not defined.
--- drivers/platform/x86/asus-wmi.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/platform/x86/asus-wmi.c +9 -0
@@ -5005,6 +5005,7 @@ static int asus_hotk_restore(struct device *device)return 0 ; } +#if defined(CONFIG_SUSPEND )static void asus_ally_s2idle_restore (void ) {if (use_ally_mcu_hack ==ASUS_WMI_ALLY_MCU_HACK_ENABLED ) {
@@ -5013,6 +5014,7 @@ static void asus_ally_s2idle_restore(void) msleep(ASUS_USB0_PWR_EC0_CSEE_WAIT); } } +#endif /* CONFIG_SUSPEND */ static int asus_hotk_prepare (struct device *device) {
@@ -5025,9 +5027,11 @@ static int asus_hotk_prepare(struct device *device) }/* Use only for Ally devices due to the wake_on_ac */ +#if defined(CONFIG_SUSPEND )static struct acpi_s2idle_dev_ops asus_ally_s2idle_dev_ops = { .restore = asus_ally_s2idle_restore, }; +#endif /* CONFIG_SUSPEND */ static const struct dev_pm_ops asus_pm_ops = { .thaw = asus_hotk_thaw,
@@ -5060,9 +5064,11 @@ static int asus_wmi_probe(struct platform_device *pdev)return ret; } +#if defined(CONFIG_SUSPEND ) ret =acpi_register_lps0_dev (&asus_ally_s2idle_dev_ops);if (ret)pr_warn ("failed to register LPS0 sleep handler in asus-wmi\n" ); +#endif /* CONFIG_SUSPEND */ return asus_wmi_add (pdev); }
@@ -5096,7 +5102,10 @@ EXPORT_SYMBOL_GPL(asus_wmi_register_driver);void asus_wmi_unregister_driver (struct asus_wmi_driver *driver) { +#if defined(CONFIG_SUSPEND )acpi_unregister_lps0_dev (&asus_ally_s2idle_dev_ops); +#endif /* CONFIG_SUSPEND */ +platform_device_unregister (driver->platform_device);platform_driver_unregister (&driver->platform_driver); used = false;
Signature · 1 line
2.49.0
Ilpo Järvinen
maintainerQuoted 1 line · Luke Jones
The patch "Refactor Ally suspend/resume" introduced an
The commit feea7bd6b02d ("...")
Quoted 24 lines
acpi_s2idle_dev_opsfor use with ROG Ally which caused a build error ifCONFIG_SUSPENDwas not defined.Signed-off-by Luke Jones <[email protected]>Reported-by kernel test robot <[email protected]>Fixes feea7bd6b02d ("platform/x86: asus-wmi: Refactor Ally suspend/resume")--- drivers/platform/x86/asus-wmi.c | 9 +++++++++ 1 file changed, 9 insertions(+)drivers/platform/x86/asus-wmi.c +1
-0@@ -5005,6 +5005,7 @@ static int asus_hotk_restore(struct device *device)return 0 ; } +#if defined(CONFIG_SUSPEND )static void asus_ally_s2idle_restore (void ) {if (use_ally_mcu_hack ==ASUS_WMI_ALLY_MCU_HACK_ENABLED ) {
drivers/platform/x86/asus-wmi.c static void asus_ally_s2idle_restore(void) · line 5017
Quoted 4 lines
drivers/platform/x86/asus-wmi.c +1
-0@@ -5013,6 +5014,7 @@ static void asus_ally_s2idle_restore(void) msleep(ASUS_USB0_PWR_EC0_CSEE_WAIT); } } +#endif /* CONFIG_SUSPEND */
Move this function below asus_hotk_prepare() next to ops, so that only one #if block is needed for them.
Quoted 28 lines
drivers/platform/x86/asus-wmi.c +4
-0static int asus_hotk_prepare (struct device *device) {@@ -5025,9 +5027,11 @@ static int asus_hotk_prepare(struct device *device) }/* Use only for Ally devices due to the wake_on_ac */ +#if defined(CONFIG_SUSPEND )static struct acpi_s2idle_dev_ops asus_ally_s2idle_dev_ops = { .restore = asus_ally_s2idle_restore, }; +#endif /* CONFIG_SUSPEND */ static const struct dev_pm_ops asus_pm_ops = { .thaw = asus_hotk_thaw,@@ -5060,9 +5064,11 @@ static int asus_wmi_probe(struct platform_device *pdev)return ret; } +#if defined(CONFIG_SUSPEND ) ret =acpi_register_lps0_dev (&asus_ally_s2idle_dev_ops);if (ret)pr_warn ("failed to register LPS0 sleep handler in asus-wmi\n" ); +#endif /* CONFIG_SUSPEND */ return asus_wmi_add (pdev); }
drivers/platform/x86/asus-wmi.c EXPORT_SYMBOL_GPL(asus_wmi_register_driver); · line 5107
Quoted 6 lines
drivers/platform/x86/asus-wmi.c +2
-0@@ -5096,7 +5102,10 @@ EXPORT_SYMBOL_GPL(asus_wmi_register_driver);void asus_wmi_unregister_driver (struct asus_wmi_driver *driver) { +#if defined(CONFIG_SUSPEND )acpi_unregister_lps0_dev (&asus_ally_s2idle_dev_ops); +#endif /* CONFIG_SUSPEND */
I'd have preferred these reg/unreg be solved with wrappers (see pmc_atom.c).
Signature · 1 line
i.
Luke Jones
maintainerQuoted 25 lines · Ilpo Järvinen
Quoted 1 line · Luke Jones
The patch "Refactor Ally suspend/resume" introduced an
The commit
feea7bd6b02d("...")Quoted 19 lines
acpi_s2idle_dev_opsfor use with ROG Ally which caused a build error ifCONFIG_SUSPENDwas not defined.Signed-off-by Luke Jones <[email protected]>Reported-by kernel test robot <[email protected]>Fixes feea7bd6b02d ("platform/x86: asus-wmi: Refactor Ally suspend/resume")--- drivers/platform/x86/asus-wmi.c | 9 +++++++++ 1 file changed, 9 insertions(+)drivers/platform/x86/asus-wmi.c +0
-0@@ -5005,6 +5005,7 @@ static int asus_hotk_restore(struct device *device)return 0 ; }
Quoted 13 lines
drivers/platform/x86/asus-wmi.c static void asus_ally_s2idle_restore(void) · line 5017
Quoted 9 lines
drivers/platform/x86/asus-wmi.c +2
-0+#if defined(CONFIG_SUSPEND )static void asus_ally_s2idle_restore (void ) {if (use_ally_mcu_hack ==ASUS_WMI_ALLY_MCU_HACK_ENABLED ) {@@ -5013,6 +5014,7 @@ static void asus_ally_s2idle_restore(void) msleep(ASUS_USB0_PWR_EC0_CSEE_WAIT); } } +#endif /* CONFIG_SUSPEND */ Move this function below
asus_hotk_prepare()next to ops, so that only one #if block is needed for them.
Done
Quoted 29 lines
Quoted 29 lines
drivers/platform/x86/asus-wmi.c +4
-0static int asus_hotk_prepare (struct device *device) {@@ -5025,9 +5027,11 @@ static int asus_hotk_prepare(struct device *device) }/* Use only for Ally devices due to the wake_on_ac */ +#if defined(CONFIG_SUSPEND )static struct acpi_s2idle_dev_ops asus_ally_s2idle_dev_ops = { .restore = asus_ally_s2idle_restore, }; +#endif /* CONFIG_SUSPEND */ static const struct dev_pm_ops asus_pm_ops = { .thaw = asus_hotk_thaw,@@ -5060,9 +5064,11 @@ static int asus_wmi_probe(struct platform_device *pdev)return ret; } +#if defined(CONFIG_SUSPEND ) ret =acpi_register_lps0_dev (&asus_ally_s2idle_dev_ops);if (ret)pr_warn ("failed to register LPS0 sleep handler in asus-wmi\n" ); +#endif /* CONFIG_SUSPEND */ return asus_wmi_add (pdev); }@@ -5096,7 +5102,10 @@ EXPORT_SYMBOL_GPL(asus_wmi_register_driver);
Quoted 8 lines
drivers/platform/x86/asus-wmi.c EXPORT_SYMBOL_GPL(asus_wmi_register_driver); · line 5107
Quoted 5 lines
drivers/platform/x86/asus-wmi.c +2
-0void asus_wmi_unregister_driver (struct asus_wmi_driver *driver) { +#if defined(CONFIG_SUSPEND )acpi_unregister_lps0_dev (&asus_ally_s2idle_dev_ops); +#endif /* CONFIG_SUSPEND */ I'd have preferred these reg/unreg be solved with wrappers (see
pmc_atom.c).
Can do, but I don't really understand the difference it makes in this context. Should I log that CONFIG_SUSPEND was not enabled? Otherwise it's just as good as not there, right?
Quoted 4 lines
Signature · 2 lines
-- i.
Ilpo Järvinen
maintainerQuoted 80 lines · Luke Jones
Quoted 25 lines · Ilpo Järvinen
Quoted 1 line · Luke Jones
The patch "Refactor Ally suspend/resume" introduced an
The commit
feea7bd6b02d("...")Quoted 19 lines
acpi_s2idle_dev_opsfor use with ROG Ally which caused a build error ifCONFIG_SUSPENDwas not defined.Signed-off-by Luke Jones <[email protected]>Reported-by kernel test robot <[email protected]>Fixes feea7bd6b02d ("platform/x86: asus-wmi: Refactor Ally suspend/resume")--- drivers/platform/x86/asus-wmi.c | 9 +++++++++ 1 file changed, 9 insertions(+)drivers/platform/x86/asus-wmi.c +0
-0@@ -5005,6 +5005,7 @@ static int asus_hotk_restore(struct device *device)return 0 ; }Quoted 13 lines
drivers/platform/x86/asus-wmi.c static void asus_ally_s2idle_restore(void) · line 5017
Quoted 9 lines
drivers/platform/x86/asus-wmi.c +2
-0+#if defined(CONFIG_SUSPEND )static void asus_ally_s2idle_restore (void ) {if (use_ally_mcu_hack ==ASUS_WMI_ALLY_MCU_HACK_ENABLED ) {@@ -5013,6 +5014,7 @@ static void asus_ally_s2idle_restore(void) msleep(ASUS_USB0_PWR_EC0_CSEE_WAIT); } } +#endif /* CONFIG_SUSPEND */ Move this function below
asus_hotk_prepare()next to ops, so that only one #if block is needed for them.Done
Quoted 29 lines
Quoted 29 lines
drivers/platform/x86/asus-wmi.c +4
-0static int asus_hotk_prepare (struct device *device) {@@ -5025,9 +5027,11 @@ static int asus_hotk_prepare(struct device *device) }/* Use only for Ally devices due to the wake_on_ac */ +#if defined(CONFIG_SUSPEND )static struct acpi_s2idle_dev_ops asus_ally_s2idle_dev_ops = { .restore = asus_ally_s2idle_restore, }; +#endif /* CONFIG_SUSPEND */ static const struct dev_pm_ops asus_pm_ops = { .thaw = asus_hotk_thaw,@@ -5060,9 +5064,11 @@ static int asus_wmi_probe(struct platform_device *pdev)return ret; } +#if defined(CONFIG_SUSPEND ) ret =acpi_register_lps0_dev (&asus_ally_s2idle_dev_ops);if (ret)pr_warn ("failed to register LPS0 sleep handler in asus-wmi\n" ); +#endif /* CONFIG_SUSPEND */ return asus_wmi_add (pdev); }@@ -5096,7 +5102,10 @@ EXPORT_SYMBOL_GPL(asus_wmi_register_driver);Quoted 8 lines
drivers/platform/x86/asus-wmi.c EXPORT_SYMBOL_GPL(asus_wmi_register_driver); · line 5107
Quoted 5 lines
drivers/platform/x86/asus-wmi.c +2
-0void asus_wmi_unregister_driver (struct asus_wmi_driver *driver) { +#if defined(CONFIG_SUSPEND )acpi_unregister_lps0_dev (&asus_ally_s2idle_dev_ops); +#endif /* CONFIG_SUSPEND */ I'd have preferred these reg/unreg be solved with wrappers (see
pmc_atom.c).
Quoted 1 line
Can do, but I don't really understand the difference it makes in this context. Should I log that
CONFIG_SUSPENDwas not enabled? Otherwise it's just as good as not there, right?
I just want to limit the use of ifdeffery to minimum and prefer using #else + a stub over sprinkling ifdefs all over the place. And it's orthogonal whether the CONFIG_SUSPEND=n should print a warning or not.
I'll take the v3.
Signature · 1 line
i.