git: a78c9a2a47f2 - main - acpi_spmc(4): Constraints: Clearer message on handle retrieve error

From: Olivier Certner <olce_at_FreeBSD.org>
Date: Wed, 13 May 2026 12:39:47 UTC
The branch main has been updated by olce:

URL: https://cgit.FreeBSD.org/src/commit/?id=a78c9a2a47f2209328bd25e527bd20cfab6d3665

commit a78c9a2a47f2209328bd25e527bd20cfab6d3665
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2026-05-04 12:00:39 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2026-05-13 12:38:21 +0000

    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
---
 sys/dev/acpica/acpi_spmc.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/sys/dev/acpica/acpi_spmc.c b/sys/dev/acpica/acpi_spmc.c
index 530d719fd66e..15b97347e8eb 100644
--- a/sys/dev/acpica/acpi_spmc.c
+++ b/sys/dev/acpica/acpi_spmc.c
@@ -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)))