Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys - Rename iic_compat_match() to iic_compatible_match() an...



details:   https://anonhg.NetBSD.org/src/rev/c727a9295870
branches:  trunk
changeset: 319997:c727a9295870
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon Jun 18 17:07:07 2018 +0000

description:
- Rename iic_compat_match() to iic_compatible_match() and change it
  to use the new device_compatible_match() routine.  A pointer to
  the matching device_compatible_entry is returned if a match is
  found.
- Adjust iic_use_direct_match() accordingly.
- i2c drivers now provide device_compatible_entry tables when performing
  direct-config matching.
- In the dsrtc driver, take advantage of this new capability to greatly
  simplify model selection.

(I'm coming for you next, of_compat_data...)

diffstat:

 sys/arch/macppc/dev/deq.c              |   11 +-
 sys/arch/macppc/dev/smusat.c           |    7 +-
 sys/arch/sparc64/dev/pcf8591_envctrl.c |   11 +-
 sys/dev/i2c/adadc.c                    |   13 +-
 sys/dev/i2c/adm1021.c                  |   11 +-
 sys/dev/i2c/adm1026.c                  |    9 +-
 sys/dev/i2c/as3722.c                   |   11 +-
 sys/dev/i2c/at24cxx.c                  |   11 +-
 sys/dev/i2c/axp20x.c                   |   11 +-
 sys/dev/i2c/axp22x.c                   |   11 +-
 sys/dev/i2c/dbcool.c                   |   12 +-
 sys/dev/i2c/ds1307.c                   |  217 +++++++++++++++-----------------
 sys/dev/i2c/dstemp.c                   |   11 +-
 sys/dev/i2c/fcu.c                      |   11 +-
 sys/dev/i2c/i2c.c                      |   56 ++++----
 sys/dev/i2c/i2cvar.h                   |   10 +-
 sys/dev/i2c/ihidev.c                   |   11 +-
 sys/dev/i2c/lm75.c                     |   11 +-
 sys/dev/i2c/lm87.c                     |   11 +-
 sys/dev/i2c/max77620.c                 |   12 +-
 sys/dev/i2c/pcf8563.c                  |   11 +-
 sys/dev/i2c/sy8106a.c                  |   11 +-
 sys/dev/i2c/tcagpio.c                  |   11 +-
 sys/dev/i2c/tcakp.c                    |   11 +-
 sys/dev/i2c/titemp.c                   |   11 +-
 sys/dev/i2c/tsl256x.c                  |   11 +-
 26 files changed, 320 insertions(+), 214 deletions(-)

diffs (truncated from 1272 to 300 lines):

diff -r 0dc45bcc9adb -r c727a9295870 sys/arch/macppc/dev/deq.c
--- a/sys/arch/macppc/dev/deq.c Mon Jun 18 16:31:42 2018 +0000
+++ b/sys/arch/macppc/dev/deq.c Mon Jun 18 17:07:07 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: deq.c,v 1.14 2018/06/16 21:22:13 thorpej Exp $ */
+/*     $NetBSD: deq.c,v 1.15 2018/06/18 17:07:07 thorpej Exp $ */
 
 /*-
  * Copyright (C) 2005 Michael Lorenz
@@ -32,7 +32,7 @@
  */
  
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: deq.c,v 1.14 2018/06/16 21:22:13 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: deq.c,v 1.15 2018/06/18 17:07:07 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -61,13 +61,18 @@
        NULL
 };
 
+static const struct device_compatible_entry deq_compat_data[] = {
+       DEVICE_COMPAT_ENTRY(deq_compats),
+       DEVICE_COMPAT_TERMINATOR
+};
+
 int
 deq_match(device_t parent, struct cfdata *cf, void *aux)
 {
        struct i2c_attach_args *ia = aux;
        int match_result;
 
-       if (iic_use_direct_match(ia, cf, deq_compats, &match_result))
+       if (iic_use_direct_match(ia, cf, deq_compat_data, &match_result))
                return match_result;
 
        /* This driver is direct-config only. */
diff -r 0dc45bcc9adb -r c727a9295870 sys/arch/macppc/dev/smusat.c
--- a/sys/arch/macppc/dev/smusat.c      Mon Jun 18 16:31:42 2018 +0000
+++ b/sys/arch/macppc/dev/smusat.c      Mon Jun 18 17:07:07 2018 +0000
@@ -111,13 +111,18 @@
        NULL
 };
 
+static const struct device_compatible_entry smusat_compat_data[] = {
+       DEVICE_COMPAT_ENTRY(smusat_compats),
+       DEVICE_COMPAT_TERMINATOR
+};
+
 static int
 smusat_match(device_t parent, struct cfdata *cf, void *aux)
 {
        struct i2c_attach_args *ia = aux;
        int match_result;
 
-       if (iic_use_direct_match(ia, cf, smusat_compats, &match_result))
+       if (iic_use_direct_match(ia, cf, smusat_compat_data, &match_result))
                return match_result;
 
        if (ia->ia_addr == 0x58)
diff -r 0dc45bcc9adb -r c727a9295870 sys/arch/sparc64/dev/pcf8591_envctrl.c
--- a/sys/arch/sparc64/dev/pcf8591_envctrl.c    Mon Jun 18 16:31:42 2018 +0000
+++ b/sys/arch/sparc64/dev/pcf8591_envctrl.c    Mon Jun 18 17:07:07 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pcf8591_envctrl.c,v 1.7 2018/06/16 21:22:13 thorpej Exp $      */
+/*     $NetBSD: pcf8591_envctrl.c,v 1.8 2018/06/18 17:07:07 thorpej Exp $      */
 /*     $OpenBSD: pcf8591_envctrl.c,v 1.6 2007/10/25 21:17:20 kettenis Exp $ */
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pcf8591_envctrl.c,v 1.7 2018/06/16 21:22:13 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcf8591_envctrl.c,v 1.8 2018/06/18 17:07:07 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -74,13 +74,18 @@
        NULL
 };
 
+static const struct device_compatible_entry ecadc_compat_data[] = {
+       DEVICE_COMPAT_ENTRY(ecadc_compats),
+       DEVICE_COMPAT_TERMINATOR
+};
+
 static int
 ecadc_match(device_t parent, cfdata_t cf, void *aux)
 {
        struct i2c_attach_args *ia = aux;
        int match_result;
 
-       if (iic_use_direct_match(ia, cf, ecadc_compats, &match_result))
+       if (iic_use_direct_match(ia, cf, ecadc_compat_data, &match_result))
                return match_result;
 
        /* This driver is direct-config only. */
diff -r 0dc45bcc9adb -r c727a9295870 sys/dev/i2c/adadc.c
--- a/sys/dev/i2c/adadc.c       Mon Jun 18 16:31:42 2018 +0000
+++ b/sys/dev/i2c/adadc.c       Mon Jun 18 17:07:07 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: adadc.c,v 1.4 2018/06/16 21:22:13 thorpej Exp $ */
+/* $NetBSD: adadc.c,v 1.5 2018/06/18 17:07:07 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2018 Michael Lorenz
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: adadc.c,v 1.4 2018/06/16 21:22:13 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adadc.c,v 1.5 2018/06/18 17:07:07 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -93,11 +93,16 @@
 CFATTACH_DECL_NEW(adadc, sizeof(struct adadc_softc),
     adadc_match, adadc_attach, NULL, NULL);
 
-static const char * dstemp_compats[] = {
+static const char * adadc_compats[] = {
        "ad7417",
        NULL
 };
 
+static const struct device_compatible_entry adadc_compat_data[] = {
+       DEVICE_COMPAT_ENTRY(adadc_compats),
+       DEVICE_COMPAT_TERMINATOR
+};
+
 /* calibaration table from Darwin via Linux */
 static int slope[5] = {0, 0, 0x0320, 0x00a0, 0x1f40};
 
@@ -107,7 +112,7 @@
        struct i2c_attach_args *ia = aux;
        int match_result;
 
-       if (iic_use_direct_match(ia, match, dstemp_compats, &match_result))
+       if (iic_use_direct_match(ia, match, adadc_compat_data, &match_result))
                return match_result;
 
        /*
diff -r 0dc45bcc9adb -r c727a9295870 sys/dev/i2c/adm1021.c
--- a/sys/dev/i2c/adm1021.c     Mon Jun 18 16:31:42 2018 +0000
+++ b/sys/dev/i2c/adm1021.c     Mon Jun 18 17:07:07 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: adm1021.c,v 1.17 2018/06/16 21:22:13 thorpej Exp $ */
+/*     $NetBSD: adm1021.c,v 1.18 2018/06/18 17:07:07 thorpej Exp $ */
 /*     $OpenBSD: adm1021.c,v 1.27 2007/06/24 05:34:35 dlg Exp $        */
 
 /*
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: adm1021.c,v 1.17 2018/06/16 21:22:13 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adm1021.c,v 1.18 2018/06/18 17:07:07 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -158,13 +158,18 @@
        NULL
 };
 
+static const struct device_compatible_entry admtemp_compat_data[] = {
+       DEVICE_COMPAT_ENTRY(admtemp_compats),
+       DEVICE_COMPAT_TERMINATOR
+};
+
 int
 admtemp_match(device_t parent, cfdata_t match, void *aux)
 {
        struct i2c_attach_args *ia = aux;
        int match_result;
 
-       if (iic_use_direct_match(ia, match, admtemp_compats, &match_result))
+       if (iic_use_direct_match(ia, match, admtemp_compat_data, &match_result))
                return match_result;
        
        /*
diff -r 0dc45bcc9adb -r c727a9295870 sys/dev/i2c/adm1026.c
--- a/sys/dev/i2c/adm1026.c     Mon Jun 18 16:31:42 2018 +0000
+++ b/sys/dev/i2c/adm1026.c     Mon Jun 18 17:07:07 2018 +0000
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: adm1026.c,v 1.3 2018/06/16 21:22:13 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adm1026.c,v 1.4 2018/06/18 17:07:07 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -127,6 +127,11 @@
        NULL
 };
 
+static const struct device_compatible_entry adm1026_compat_data[] = {
+       DEVICE_COMPAT_ENTRY(adm1026_compats),
+       DEVICE_COMPAT_TERMINATOR
+};
+
 static int
 adm1026_match(device_t parent, cfdata_t cf, void *aux)
 {
@@ -138,7 +143,7 @@
        sc.sc_address = ia->ia_addr;
        sc.sc_iic_flags = 0;
 
-       if (iic_use_direct_match(ia, cf, adm1026_compats, &match_result))
+       if (iic_use_direct_match(ia, cf, adm1026_compat_data, &match_result))
                return match_result;
 
        if ((ia->ia_addr & ADM1026_ADDRMASK) == ADM1026_ADDR &&
diff -r 0dc45bcc9adb -r c727a9295870 sys/dev/i2c/as3722.c
--- a/sys/dev/i2c/as3722.c      Mon Jun 18 16:31:42 2018 +0000
+++ b/sys/dev/i2c/as3722.c      Mon Jun 18 17:07:07 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: as3722.c,v 1.13 2018/06/16 21:22:13 thorpej Exp $ */
+/* $NetBSD: as3722.c,v 1.14 2018/06/18 17:07:07 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 #include "opt_fdt.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: as3722.c,v 1.13 2018/06/16 21:22:13 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: as3722.c,v 1.14 2018/06/18 17:07:07 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -227,6 +227,11 @@
        NULL
 };
 
+static const struct device_compatible_entry as3722_compat_data[] = {
+       DEVICE_COMPAT_ENTRY(as3722_compats),
+       DEVICE_COMPAT_TERMINATOR
+};
+
 static int
 as3722_match(device_t parent, cfdata_t match, void *aux)
 {
@@ -234,7 +239,7 @@
        uint8_t reg, id1;
        int error, match_result;
 
-       if (iic_use_direct_match(ia, match, as3722_compats, &match_result))
+       if (iic_use_direct_match(ia, match, as3722_compat_data, &match_result))
                return match_result;
        
        if (ia->ia_addr != AS3722_I2C_ADDR)
diff -r 0dc45bcc9adb -r c727a9295870 sys/dev/i2c/at24cxx.c
--- a/sys/dev/i2c/at24cxx.c     Mon Jun 18 16:31:42 2018 +0000
+++ b/sys/dev/i2c/at24cxx.c     Mon Jun 18 17:07:07 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: at24cxx.c,v 1.26 2018/06/16 21:22:13 thorpej Exp $     */
+/*     $NetBSD: at24cxx.c,v 1.27 2018/06/18 17:07:07 thorpej Exp $     */
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: at24cxx.c,v 1.26 2018/06/16 21:22:13 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: at24cxx.c,v 1.27 2018/06/18 17:07:07 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -127,13 +127,18 @@
        { "atmel,24c16", 2048 },
 };
 
+static const struct device_compatible_entry seeprom_compat_data[] = {
+       DEVICE_COMPAT_ENTRY(seeprom_compats),
+       DEVICE_COMPAT_TERMINATOR
+};
+
 static int
 seeprom_match(device_t parent, cfdata_t cf, void *aux)
 {
        struct i2c_attach_args *ia = aux;
        int match_result;
 
-       if (iic_use_direct_match(ia, cf, seeprom_compats, &match_result))
+       if (iic_use_direct_match(ia, cf, seeprom_compat_data, &match_result))
                return match_result;
 
        if ((ia->ia_addr & AT24CXX_ADDRMASK) == AT24CXX_ADDR)
diff -r 0dc45bcc9adb -r c727a9295870 sys/dev/i2c/axp20x.c
--- a/sys/dev/i2c/axp20x.c      Mon Jun 18 16:31:42 2018 +0000
+++ b/sys/dev/i2c/axp20x.c      Mon Jun 18 17:07:07 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: axp20x.c,v 1.11 2018/06/16 21:22:13 thorpej Exp $ */
+/* $NetBSD: axp20x.c,v 1.12 2018/06/18 17:07:07 thorpej Exp $ */
 
 /*-



Home | Main Index | Thread Index | Old Index