Module Name:    src
Committed By:   thorpej
Date:           Wed Dec 23 17:10:37 UTC 2020

Modified Files:
        src/sys/dev/i2c: em3027.c

Log Message:
Add direct-config support.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/i2c/em3027.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/i2c/em3027.c
diff -u src/sys/dev/i2c/em3027.c:1.3 src/sys/dev/i2c/em3027.c:1.4
--- src/sys/dev/i2c/em3027.c:1.3	Sat Jul 27 16:02:27 2019
+++ src/sys/dev/i2c/em3027.c	Wed Dec 23 17:10:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: em3027.c,v 1.3 2019/07/27 16:02:27 thorpej Exp $ */
+/*	$NetBSD: em3027.c,v 1.4 2020/12/23 17:10:37 thorpej Exp $ */
 /*
  * Copyright (c) 2018 Valery Ushakov
  * All rights reserved.
@@ -28,7 +28,7 @@
  * EM Microelectronic EM3027 RTC
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: em3027.c,v 1.3 2019/07/27 16:02:27 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: em3027.c,v 1.4 2020/12/23 17:10:37 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -105,7 +105,10 @@ static int em3027rtc_write(struct em3027
 static int em3027rtc_read_byte(struct em3027rtc_softc *, uint8_t, uint8_t *);
 static int em3027rtc_write_byte(struct em3027rtc_softc *, uint8_t, uint8_t);
 
-
+static const struct device_compatible_entry compat_data[] = {
+	{ "emmicro,em3027",			0 },
+	{ NULL,					0 },
+};
 
 static int
 em3027rtc_match(device_t parent, cfdata_t cf, void *aux)
@@ -113,6 +116,10 @@ em3027rtc_match(device_t parent, cfdata_
 	const struct i2c_attach_args *ia = aux;
 	uint8_t reg;
 	int error;
+	int match_result;
+
+	if (iic_use_direct_match(ia, cf, compat_data, &match_result))
+		return match_result;
 
 	if (ia->ia_addr != EM3027_ADDR)
 		return 0;

Reply via email to