Skip to content

Commit

Permalink
check for power state only when ACPI is available
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Andrea Righi <[email protected]>
  • Loading branch information
Andrea Righi committed Nov 26, 2021
1 parent ddbd243 commit 83c72d8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bbswitch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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())
Expand Down

0 comments on commit 83c72d8

Please sign in to comment.