Skip to content

Commit 7ff5f09

Browse files
flukejonesij-intel
authored andcommitted
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: feea7bd ("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>
1 parent cad37fa commit 7ff5f09

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

drivers/platform/x86/asus-wmi.c

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5015,30 +5015,46 @@ static int asus_hotk_restore(struct device *device)
50155015
return 0;
50165016
}
50175017

5018-
static void asus_ally_s2idle_restore(void)
5018+
static int asus_hotk_prepare(struct device *device)
50195019
{
50205020
if (use_ally_mcu_hack == ASUS_WMI_ALLY_MCU_HACK_ENABLED) {
50215021
acpi_execute_simple_method(NULL, ASUS_USB0_PWR_EC0_CSEE,
5022-
ASUS_USB0_PWR_EC0_CSEE_ON);
5022+
ASUS_USB0_PWR_EC0_CSEE_OFF);
50235023
msleep(ASUS_USB0_PWR_EC0_CSEE_WAIT);
50245024
}
5025+
return 0;
50255026
}
50265027

5027-
static int asus_hotk_prepare(struct device *device)
5028+
#if defined(CONFIG_SUSPEND)
5029+
static void asus_ally_s2idle_restore(void)
50285030
{
50295031
if (use_ally_mcu_hack == ASUS_WMI_ALLY_MCU_HACK_ENABLED) {
50305032
acpi_execute_simple_method(NULL, ASUS_USB0_PWR_EC0_CSEE,
5031-
ASUS_USB0_PWR_EC0_CSEE_OFF);
5033+
ASUS_USB0_PWR_EC0_CSEE_ON);
50325034
msleep(ASUS_USB0_PWR_EC0_CSEE_WAIT);
50335035
}
5034-
return 0;
50355036
}
50365037

50375038
/* Use only for Ally devices due to the wake_on_ac */
50385039
static struct acpi_s2idle_dev_ops asus_ally_s2idle_dev_ops = {
50395040
.restore = asus_ally_s2idle_restore,
50405041
};
50415042

5043+
static void asus_s2idle_check_register(void)
5044+
{
5045+
if (acpi_register_lps0_dev(&asus_ally_s2idle_dev_ops))
5046+
pr_warn("failed to register LPS0 sleep handler in asus-wmi\n");
5047+
}
5048+
5049+
static void asus_s2idle_check_unregister(void)
5050+
{
5051+
acpi_unregister_lps0_dev(&asus_ally_s2idle_dev_ops);
5052+
}
5053+
#else
5054+
static void asus_s2idle_check_register(void) {}
5055+
static void asus_s2idle_check_unregister(void) {}
5056+
#endif /* CONFIG_SUSPEND */
5057+
50425058
static const struct dev_pm_ops asus_pm_ops = {
50435059
.thaw = asus_hotk_thaw,
50445060
.restore = asus_hotk_restore,
@@ -5070,9 +5086,7 @@ static int asus_wmi_probe(struct platform_device *pdev)
50705086
return ret;
50715087
}
50725088

5073-
ret = acpi_register_lps0_dev(&asus_ally_s2idle_dev_ops);
5074-
if (ret)
5075-
pr_warn("failed to register LPS0 sleep handler in asus-wmi\n");
5089+
asus_s2idle_check_register();
50765090

50775091
return asus_wmi_add(pdev);
50785092
}
@@ -5106,7 +5120,8 @@ EXPORT_SYMBOL_GPL(asus_wmi_register_driver);
51065120

51075121
void asus_wmi_unregister_driver(struct asus_wmi_driver *driver)
51085122
{
5109-
acpi_unregister_lps0_dev(&asus_ally_s2idle_dev_ops);
5123+
asus_s2idle_check_unregister();
5124+
51105125
platform_device_unregister(driver->platform_device);
51115126
platform_driver_unregister(&driver->platform_driver);
51125127
used = false;

0 commit comments

Comments
 (0)