From 27645265c4e49ad7eaa25847a280307acb138da8 Mon Sep 17 00:00:00 2001 From: Andriy Gapon Date: Thu, 4 Nov 2021 13:55:35 +0200 Subject: [PATCH] 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. MFC after: 2 weeks --- sys/dev/iicbus/ds1307.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/sys/dev/iicbus/ds1307.c b/sys/dev/iicbus/ds1307.c index 7bab7e78c0d..47f47bb07f5 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 - device_set_desc(dev, "Maxim DS1307 RTC"); - - return (BUS_PROBE_NOWILDCARD); + 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); } static int