git: 4d1161f094dd - main - subr_bus: report DEVICE_SUSPEND failures

From: Andriy Gapon <avg_at_FreeBSD.org>
Date: Sun, 28 Jan 2024 13:21:49 UTC
The branch main has been updated by avg:

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

commit 4d1161f094dd90428847f7e5989767e9957055f4
Author:     Andriy Gapon <avg@FreeBSD.org>
AuthorDate: 2023-01-03 08:39:32 +0000
Commit:     Andriy Gapon <avg@FreeBSD.org>
CommitDate: 2024-01-28 13:21:09 +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.
---
 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 21c2835f2ae6..c06f3df0c9c9 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -3463,8 +3463,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);
 }