git: 0cef5efbbf93 - main - acpi_spmc(4): Stop pretending that all constraints are verified

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

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

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

    acpi_spmc(4): Stop pretending that all constraints are verified
    
    We do not check these constraints (yet), so stop printing that they are
    verified.
    
    While here, make the (not compiled in at the moment) "constraint
    violated" message more terse, and move the warning it contains to
    outside of the loop (no need to print it repeatedly if multiple
    constraints are violated).
    
    While here, bail out early if there are no constraints to avoid printing
    (in the future) that constraints are respected even when there are none.
    
    Reviewed by:    imp (older version), obiwac
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D56809
---
 sys/dev/acpica/acpi_spmc.c | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/sys/dev/acpica/acpi_spmc.c b/sys/dev/acpica/acpi_spmc.c
index 15b97347e8eb..58197242ff92 100644
--- a/sys/dev/acpica/acpi_spmc.c
+++ b/sys/dev/acpica/acpi_spmc.c
@@ -655,9 +655,17 @@ acpi_spmc_get_constraints(device_t dev)
 static void
 acpi_spmc_check_constraints(struct acpi_spmc_softc *sc)
 {
+#ifdef notyet
 	bool violation = false;
+#endif
 
 	KASSERT(sc->constraints_populated, ("Constraints not populated"));
+	/*
+	 * Avoid printing that constraints are respected when there are no
+	 * constraints at all.
+	 */
+	if (sc->constraint_count == 0)
+		return;
 	for (size_t i = 0; i < sc->constraint_count; i++) {
 		struct acpi_spmc_constraint *constraint = &sc->constraints[i];
 
@@ -671,19 +679,24 @@ acpi_spmc_check_constraints(struct acpi_spmc_softc *sc)
 		if (ACPI_FAILURE(acpi_pwr_get_state(constraint->handle, &d_state)))
 			continue;
 		if (d_state < constraint->min_d_state) {
-			device_printf(sc->dev, "constraint for device %s"
-			    " violated (minimum D-state required was %s, actual"
-			    " D-state is %s), might fail to enter LPI state\n",
+			device_printf(sc->dev, "Constraint for device %s"
+			    " violated (current D-state: %s, "
+			    "required minimum D-state: %s).\n"
 			    constraint->name,
-			    acpi_d_state_to_str(constraint->min_d_state),
-			    acpi_d_state_to_str(d_state));
+			    acpi_d_state_to_str(d_state),
+			    acpi_d_state_to_str(constraint->min_d_state));
 			violation = true;
 		}
 #endif
 	}
-	if (!violation)
+#ifdef notyet
+	if (violation)
+		device_printf(sc->dev, "Some constraints violated, "
+		    "might fail to enter a Low-Power Idle state\n");
+	else
 		device_printf(sc->dev,
-		    "all device power constraints respected!\n");
+		    "All device power constraints respected!\n");
+#endif
 }
 
 static void