git: a669851b3516 - stable/13 - subr_bus: report DEVICE_SUSPEND failures

From: Andriy Gapon <avg_at_FreeBSD.org>
Date: Sat, 17 Feb 2024 19:22:43 UTC
The branch stable/13 has been updated by avg:

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

commit a669851b35163a849ebcbae0c9c8048f86efde10
Author:     Andriy Gapon <avg@FreeBSD.org>
AuthorDate: 2023-01-03 08:39:32 +0000
Commit:     Andriy Gapon <avg@FreeBSD.org>
CommitDate: 2024-02-17 19:22:08 +0000

    subr_bus: report DEVICE_SUSPEND failures
    
    This greatly aids with diagnosing system suspend failures when
    they are due to a device driver or hardware.
    
    (cherry picked from commit 4d1161f094dd90428847f7e5989767e9957055f4)
---
 sys/kern/subr_bus.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
index 8abf7fa83750..d34bcc3cca58 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -3881,8 +3881,12 @@ bus_generic_suspend_child(device_t dev, device_t child)
 
 	error = DEVICE_SUSPEND(child);
 
-	if (error == 0)
+	if (error == 0) {
 		child->flags |= DF_SUSPENDED;
+	} else {
+		printf("DEVICE_SUSPEND(%s) failed: %d\n",
+		    device_get_nameunit(child), error);
+	}
 
 	return (error);
 }