diff options
author | Luke Jones <luke@ljones.dev> | 2025-05-24 12:13:42 +0200 |
---|---|---|
committer | Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> | 2025-05-25 23:44:18 +0300 |
commit | 7ff5f091409f1c1bca6374bcce54d71e8328d17f (patch) | |
tree | c754346ce222b3f083360596c90586a739380f9a | |
parent | cad37faac66c3822add86caf02fa0884d309a45f (diff) |
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.
Signed-off-by: Luke Jones <luke@ljones.dev>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202505090418.DaeaXe4i-lkp@intel.com/
Fixes: feea7bd6b02d ("platform/x86: asus-wmi: Refactor Ally suspend/resume")
Link: https://lore.kernel.org/r/20250524101343.57883-2-luke@ljones.dev
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
-rw-r--r-- | drivers/platform/x86/asus-wmi.c | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index 7eda56f7713c..f7191fdded14 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -5015,23 +5015,24 @@ static int asus_hotk_restore(struct device *device) return 0; } -static void asus_ally_s2idle_restore(void) +static int asus_hotk_prepare(struct device *device) { if (use_ally_mcu_hack == ASUS_WMI_ALLY_MCU_HACK_ENABLED) { acpi_execute_simple_method(NULL, ASUS_USB0_PWR_EC0_CSEE, - ASUS_USB0_PWR_EC0_CSEE_ON); + ASUS_USB0_PWR_EC0_CSEE_OFF); msleep(ASUS_USB0_PWR_EC0_CSEE_WAIT); } + return 0; } -static int asus_hotk_prepare(struct device *device) +#if defined(CONFIG_SUSPEND) +static void asus_ally_s2idle_restore(void) { if (use_ally_mcu_hack == ASUS_WMI_ALLY_MCU_HACK_ENABLED) { acpi_execute_simple_method(NULL, ASUS_USB0_PWR_EC0_CSEE, - ASUS_USB0_PWR_EC0_CSEE_OFF); + ASUS_USB0_PWR_EC0_CSEE_ON); msleep(ASUS_USB0_PWR_EC0_CSEE_WAIT); } - return 0; } /* Use only for Ally devices due to the wake_on_ac */ @@ -5039,6 +5040,21 @@ static struct acpi_s2idle_dev_ops asus_ally_s2idle_dev_ops = { .restore = asus_ally_s2idle_restore, }; +static void asus_s2idle_check_register(void) +{ + if (acpi_register_lps0_dev(&asus_ally_s2idle_dev_ops)) + pr_warn("failed to register LPS0 sleep handler in asus-wmi\n"); +} + +static void asus_s2idle_check_unregister(void) +{ + acpi_unregister_lps0_dev(&asus_ally_s2idle_dev_ops); +} +#else +static void asus_s2idle_check_register(void) {} +static void asus_s2idle_check_unregister(void) {} +#endif /* CONFIG_SUSPEND */ + static const struct dev_pm_ops asus_pm_ops = { .thaw = asus_hotk_thaw, .restore = asus_hotk_restore, @@ -5070,9 +5086,7 @@ static int asus_wmi_probe(struct platform_device *pdev) return ret; } - ret = acpi_register_lps0_dev(&asus_ally_s2idle_dev_ops); - if (ret) - pr_warn("failed to register LPS0 sleep handler in asus-wmi\n"); + asus_s2idle_check_register(); return asus_wmi_add(pdev); } @@ -5106,7 +5120,8 @@ EXPORT_SYMBOL_GPL(asus_wmi_register_driver); void asus_wmi_unregister_driver(struct asus_wmi_driver *driver) { - acpi_unregister_lps0_dev(&asus_ally_s2idle_dev_ops); + asus_s2idle_check_unregister(); + platform_device_unregister(driver->platform_device); platform_driver_unregister(&driver->platform_driver); used = false; |