diff mbox series

platform/x86: thinkpad_acpi: Fix compilation without CONFIG_SUSPEND

Message ID 20220503012700.1273-1-mario.limonciello@amd.com (mailing list archive)
State Accepted, archived
Headers show
Series platform/x86: thinkpad_acpi: Fix compilation without CONFIG_SUSPEND | expand

Commit Message

Mario Limonciello May 3, 2022, 1:27 a.m. UTC
When compiled without `CONFIG_SUSPEND` the extra s2idle quirk handling
doesn't make any sense and causes a kernel build failure.

Disable the new code with `CONFIG_SUSPEND` not set.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 drivers/platform/x86/thinkpad_acpi.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Hans de Goede May 6, 2022, 10:04 a.m. UTC | #1
Hi,

On 5/3/22 03:27, Mario Limonciello wrote:
> When compiled without `CONFIG_SUSPEND` the extra s2idle quirk handling
> doesn't make any sense and causes a kernel build failure.
> 
> Disable the new code with `CONFIG_SUSPEND` not set.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>

Thanks, since the original patch was still in my review-hans
branch (and not yet in for-next) I've squashed this fix into
the original patch.

Regards,

Hans




> ---
>  drivers/platform/x86/thinkpad_acpi.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
> index f385450af864..2833609fade7 100644
> --- a/drivers/platform/x86/thinkpad_acpi.c
> +++ b/drivers/platform/x86/thinkpad_acpi.c
> @@ -4482,6 +4482,7 @@ static const struct dmi_system_id fwbug_list[] __initconst = {
>  	{}
>  };
>  
> +#ifdef CONFIG_SUSPEND
>  /*
>   * Lenovo laptops from a variety of generations run a SMI handler during the D3->D0
>   * transition that occurs specifically when exiting suspend to idle which can cause
> @@ -4517,6 +4518,7 @@ static void thinkpad_acpi_amd_s2idle_restore(void)
>  static struct acpi_s2idle_dev_ops thinkpad_acpi_s2idle_dev_ops = {
>  	.restore = thinkpad_acpi_amd_s2idle_restore,
>  };
> +#endif
>  
>  static const struct pci_device_id fwbug_cards_ids[] __initconst = {
>  	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x24F3) },
> @@ -11569,8 +11571,10 @@ static void thinkpad_acpi_module_exit(void)
>  
>  	tpacpi_lifecycle = TPACPI_LIFE_EXITING;
>  
> +#ifdef CONFIG_SUSPEND
>  	if (tp_features.quirks && tp_features.quirks->s2idle_bug_mmio)
>  		acpi_unregister_lps0_dev(&thinkpad_acpi_s2idle_dev_ops);
> +#endif
>  	if (tpacpi_hwmon)
>  		hwmon_device_unregister(tpacpi_hwmon);
>  	if (tp_features.sensors_pdrv_registered)
> @@ -11743,11 +11747,13 @@ static int __init thinkpad_acpi_module_init(void)
>  	dmi_id = dmi_first_match(fwbug_list);
>  	if (dmi_id) {
>  		tp_features.quirks = dmi_id->driver_data;
> +#ifdef CONFIG_SUSPEND
>  		if (tp_features.quirks->s2idle_bug_mmio) {
>  			if (!acpi_register_lps0_dev(&thinkpad_acpi_s2idle_dev_ops))
>  				pr_info("Using s2idle quirk to avoid %s platform firmware bug\n",
>  					dmi_id->ident ? dmi_id->ident : "");
>  		}
> +#endif
>  	}
>  
>  	return 0;
diff mbox series

Patch

diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index f385450af864..2833609fade7 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -4482,6 +4482,7 @@  static const struct dmi_system_id fwbug_list[] __initconst = {
 	{}
 };
 
+#ifdef CONFIG_SUSPEND
 /*
  * Lenovo laptops from a variety of generations run a SMI handler during the D3->D0
  * transition that occurs specifically when exiting suspend to idle which can cause
@@ -4517,6 +4518,7 @@  static void thinkpad_acpi_amd_s2idle_restore(void)
 static struct acpi_s2idle_dev_ops thinkpad_acpi_s2idle_dev_ops = {
 	.restore = thinkpad_acpi_amd_s2idle_restore,
 };
+#endif
 
 static const struct pci_device_id fwbug_cards_ids[] __initconst = {
 	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x24F3) },
@@ -11569,8 +11571,10 @@  static void thinkpad_acpi_module_exit(void)
 
 	tpacpi_lifecycle = TPACPI_LIFE_EXITING;
 
+#ifdef CONFIG_SUSPEND
 	if (tp_features.quirks && tp_features.quirks->s2idle_bug_mmio)
 		acpi_unregister_lps0_dev(&thinkpad_acpi_s2idle_dev_ops);
+#endif
 	if (tpacpi_hwmon)
 		hwmon_device_unregister(tpacpi_hwmon);
 	if (tp_features.sensors_pdrv_registered)
@@ -11743,11 +11747,13 @@  static int __init thinkpad_acpi_module_init(void)
 	dmi_id = dmi_first_match(fwbug_list);
 	if (dmi_id) {
 		tp_features.quirks = dmi_id->driver_data;
+#ifdef CONFIG_SUSPEND
 		if (tp_features.quirks->s2idle_bug_mmio) {
 			if (!acpi_register_lps0_dev(&thinkpad_acpi_s2idle_dev_ops))
 				pr_info("Using s2idle quirk to avoid %s platform firmware bug\n",
 					dmi_id->ident ? dmi_id->ident : "");
 		}
+#endif
 	}
 
 	return 0;