git: 4cb348eaf6ac - stable/14 - subr_bus: report DEVICE_SUSPEND failures

From: Andriy Gapon <avg_at_FreeBSD.org>
Date: Sat, 17 Feb 2024 15:12:32 UTC
The branch stable/14 has been updated by avg:

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

commit 4cb348eaf6ac1326e79bf6c6679dbf1e219574ee
Author:     Andriy Gapon <avg@FreeBSD.org>
AuthorDate: 2023-01-03 08:39:32 +0000
Commit:     Andriy Gapon <avg@FreeBSD.org>
CommitDate: 2024-02-17 14:18:04 +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 d3db7ca5431c..38c646593a85 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);
 }