acpi_spmc(4): Constraints: Clearer message on handle retrieve error

Currently, the "failed to get handle for ..." log messages on attach are
a bit alarming and no context is provided.  Print out that these are
retrieved when trying to match constraints and that such failures are
ignored, which should make administrators worry less.

While here, remove duplicated handle retrieving code in
acpi_spmc_check_constraints() because:
1. As is, it is dead code: We 'continue' if the handle is NULL, i.e.,
   not already resolved, before trying to resolve it again.
2. This code is called after device suspension, which might make some
   objects disappear from the ACPI namespace.  In any case, it seems
   unlikely that, suddenly, new objects would appear.

Reviewed by:    imp, obiwac
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D56808
This commit is contained in:
Olivier Certner
2026-05-04 14:00:39 +02:00
parent 98ad729f3e
commit a78c9a2a47
+2 -11
View File
@@ -643,7 +643,8 @@ acpi_spmc_get_constraints(device_t dev)
status = acpi_GetHandleInScope(sc->handle,
__DECONST(char *, constraint->name), &constraint->handle);
if (ACPI_FAILURE(status)) {
device_printf(dev, "failed to get handle for %s\n",
device_printf(dev,
"Constraints: Cannot get handle for %s, ignoring\n",
constraint->name);
constraint->handle = NULL;
}
@@ -665,16 +666,6 @@ acpi_spmc_check_constraints(struct acpi_spmc_softc *sc)
if (constraint->handle == NULL)
continue;
ACPI_STATUS status = acpi_GetHandleInScope(sc->handle,
__DECONST(char *, constraint->name), &constraint->handle);
if (ACPI_FAILURE(status)) {
device_printf(sc->dev, "failed to get handle for %s\n",
constraint->name);
constraint->handle = NULL;
}
if (constraint->handle == NULL)
continue;
#ifdef notyet
int d_state;
if (ACPI_FAILURE(acpi_pwr_get_state(constraint->handle, &d_state)))