From 83c72d8276626dbb4c0d1abfb1001dfb8b5ae27c Mon Sep 17 00:00:00 2001 From: Andrea Righi Date: Fri, 19 Nov 2021 12:31:52 +0000 Subject: [PATCH] check for power state only when ACPI is available In bbswitch_off() we use acpi_bus_get_device() to determine the power state, but this feature is only available if ACPI is enabled in the kernel, so make sure to do this check only when ACPI is available. Fixes: 5593d95 ("Linux 3.8 compatibility hack") Signed-off-by: Dimitri John Ledkov Signed-off-by: Andrea Righi --- bbswitch.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bbswitch.c b/bbswitch.c index c0c6713..b87b7f3 100644 --- a/bbswitch.c +++ b/bbswitch.c @@ -262,6 +262,7 @@ static void bbswitch_off(void) { pci_save_state(dis_dev); pci_clear_master(dis_dev); pci_disable_device(dis_dev); +#ifdef CONFIG_ACPI do { struct acpi_device *ad = NULL; int r; @@ -276,6 +277,7 @@ static void bbswitch_off(void) { ad->power.state = ACPI_STATE_D0; } } while (0); +#endif pci_set_power_state(dis_dev, PCI_D3cold); if (bbswitch_acpi_off())