diff options
author | njl <njl@FreeBSD.org> | 2004-04-14 17:46:21 +0000 |
---|---|---|
committer | njl <njl@FreeBSD.org> | 2004-04-14 17:46:21 +0000 |
commit | 47c9dd6929e7190f4556eb03e265044d03177469 (patch) | |
tree | d4d345fab575910675ed684d328384629db99bdb | |
parent | e3d67bca303a9687d62f8421f4d2c32477004c03 (diff) | |
download | FreeBSD-src-47c9dd6929e7190f4556eb03e265044d03177469.zip FreeBSD-src-47c9dd6929e7190f4556eb03e265044d03177469.tar.gz |
Only try to set the ACPI power state if the handle is valid. There was
probably no problem with this except it may have had the side effect of
registering a NULL consumer.
-rw-r--r-- | sys/dev/acpica/acpi_pci.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/sys/dev/acpica/acpi_pci.c b/sys/dev/acpica/acpi_pci.c index aa95d22..736086d 100644 --- a/sys/dev/acpica/acpi_pci.c +++ b/sys/dev/acpica/acpi_pci.c @@ -162,6 +162,7 @@ acpi_pci_child_location_str_method(device_t cbdev, device_t child, char *buf, static int acpi_pci_set_powerstate_method(device_t dev, device_t child, int state) { + ACPI_HANDLE h; ACPI_STATUS status; int acpi_state, old_state, error; @@ -197,12 +198,15 @@ acpi_pci_set_powerstate_method(device_t dev, device_t child, int state) if (error) return (error); } - status = acpi_pwr_switch_consumer(acpi_get_handle(child), acpi_state); - if (ACPI_FAILURE(status)) - device_printf(dev, - "Failed to set ACPI power state D%d on %s: %s\n", - acpi_state, device_get_nameunit(child), - AcpiFormatException(status)); + h = acpi_get_handle(child); + if (h != NULL) { + status = acpi_pwr_switch_consumer(h, acpi_state); + if (ACPI_FAILURE(status)) + device_printf(dev, + "Failed to set ACPI power state D%d on %s: %s\n", + acpi_state, device_get_nameunit(child), + AcpiFormatException(status)); + } if (state > old_state) return (pci_set_powerstate_method(dev, child, state)); else |