git: 1efdba436281 - stable/14 - ds1307: restore hints-based configuration on FDT systems

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

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

commit 1efdba436281337bfd54e941cf60c74492780598
Author:     Andriy Gapon <avg@FreeBSD.org>
AuthorDate: 2023-05-02 20:46:39 +0000
Commit:     Andriy Gapon <avg@FreeBSD.org>
CommitDate: 2024-02-17 14:15:10 +0000

    ds1307: restore hints-based configuration on FDT systems
    
    Fall-through to non-FDT probe code if no matching device node is found.
    While here, fix indentation of the switch statement.
    Also, make the device description for the hints-based attachment the
    same as for FDT attachment.
    
    Fixes:  2486b446db ds1307: add support for the EPSON RX-8035SA I2C RTC
    (cherry picked from commit 34694f3da7f9537c34b1878206c65a8cda16c6c0)
---
 sys/dev/iicbus/rtc/ds1307.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/sys/dev/iicbus/rtc/ds1307.c b/sys/dev/iicbus/rtc/ds1307.c
index e8d24880571c..cc232bae0e94 100644
--- a/sys/dev/iicbus/rtc/ds1307.c
+++ b/sys/dev/iicbus/rtc/ds1307.c
@@ -225,10 +225,8 @@ ds1307_probe(device_t dev)
 		return (ENXIO);
 
 	compat = ofw_bus_search_compatible(dev, ds1307_compat_data);
-	if (compat->ocd_str == NULL)
-		return (ENXIO);
-
-	switch(compat->ocd_data) {
+	if (compat->ocd_str != NULL) {
+		switch(compat->ocd_data) {
 		case TYPE_DS1307:
 			device_set_desc(dev, "Dallas DS1307");
 			break;
@@ -244,11 +242,12 @@ ds1307_probe(device_t dev)
 		default:
 			device_set_desc(dev, "Unknown DS1307-like device");
 			break;
+		}
+		return (BUS_PROBE_DEFAULT);
 	}
-	return (BUS_PROBE_DEFAULT);
 #endif
 
-	device_set_desc(dev, "Maxim DS1307 RTC");
+	device_set_desc(dev, "Maxim DS1307");
 	return (BUS_PROBE_NOWILDCARD);
 }