git: 45a19f61218b - stable/12 - ds1307: allow configuration via hints on FDT-based systems

From: Andriy Gapon <avg_at_FreeBSD.org>
Date: Sat, 27 Nov 2021 08:52:12 UTC
The branch stable/12 has been updated by avg:

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

commit 45a19f61218b4072db9a327df5a7f176b6955163
Author:     Andriy Gapon <avg@FreeBSD.org>
AuthorDate: 2021-11-04 11:55:35 +0000
Commit:     Andriy Gapon <avg@FreeBSD.org>
CommitDate: 2021-11-27 08:46:31 +0000

    ds1307: allow configuration via hints on FDT-based systems
    
    On-board devices should be configured via the FDT and overlays.
    Hints are primarily useful for external and temporarily attached devices.
    Adding hints is much easier and faster than writing and compiling
    an overlay.
    
    (cherry picked from commit 27645265c4e49ad7eaa25847a280307acb138da8)
---
 sys/dev/iicbus/ds1307.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/sys/dev/iicbus/ds1307.c b/sys/dev/iicbus/ds1307.c
index 7bab7e78c0d8..47f47bb07f5e 100644
--- a/sys/dev/iicbus/ds1307.c
+++ b/sys/dev/iicbus/ds1307.c
@@ -216,18 +216,13 @@ ds1307_probe(device_t dev)
 		return (ENXIO);
 
 	compat = ofw_bus_search_compatible(dev, ds1307_compat_data);
-
-	if (compat->ocd_str == NULL)
-		return (ENXIO);
-
-	device_set_desc(dev, (const char *)compat->ocd_data);
-
-	return (BUS_PROBE_DEFAULT);
-#else
+	if (compat->ocd_str != NULL) {
+		device_set_desc(dev, (const char *)compat->ocd_data);
+		return (BUS_PROBE_DEFAULT);
+	}
+#endif
 	device_set_desc(dev, "Maxim DS1307 RTC");
-
 	return (BUS_PROBE_NOWILDCARD);
-#endif
 }
 
 static int