Source-Changes-HG archive

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

[src/trunk]: src/sys In my quest to make device_compatible_entry (and associa...



details:   https://anonhg.NetBSD.org/src/rev/0e83436d728d
branches:  trunk
changeset: 323688:0e83436d728d
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue Jun 26 06:03:57 2018 +0000

description:
In my quest to make device_compatible_entry (and associated goo)
super-general, it turns out I also made it a little to cumbersome
to use (if my tired fingers are any indication).  So, this is a
course-correction -- one string per entry (like of_compat_data,
which it will soon replace), and remove the over-verbose macros.

diffstat:

 sys/arch/macppc/dev/deq.c              |  25 ++++++---------
 sys/arch/macppc/dev/smusat.c           |  15 +++------
 sys/arch/sparc64/dev/pcf8591_envctrl.c |  17 +++------
 sys/dev/i2c/adadc.c                    |  17 +++------
 sys/dev/i2c/adm1021.c                  |  21 +++++--------
 sys/dev/i2c/adm1026.c                  |  15 +++------
 sys/dev/i2c/as3722.c                   |  17 +++------
 sys/dev/i2c/at24cxx.c                  |  24 ++++++--------
 sys/dev/i2c/axp20x.c                   |  17 +++------
 sys/dev/i2c/axp22x.c                   |  17 +++------
 sys/dev/i2c/axppmic.c                  |  22 ++++++-------
 sys/dev/i2c/dbcool.c                   |  23 +++++--------
 sys/dev/i2c/ds1307.c                   |  54 ++++++++++++++++++---------------
 sys/dev/i2c/dstemp.c                   |  17 +++------
 sys/dev/i2c/fcu.c                      |  17 +++------
 sys/dev/i2c/ihidev.c                   |  17 +++------
 sys/dev/i2c/lm75.c                     |  19 ++++-------
 sys/dev/i2c/lm87.c                     |  25 ++++++---------
 sys/dev/i2c/max77620.c                 |  18 +++-------
 sys/dev/i2c/pcf8563.c                  |  19 ++++-------
 sys/dev/i2c/sy8106a.c                  |  17 +++------
 sys/dev/i2c/tcagpio.c                  |  17 +++------
 sys/dev/i2c/tcakp.c                    |  17 +++------
 sys/dev/i2c/titemp.c                   |  17 +++------
 sys/dev/i2c/tsl256x.c                  |  15 +++------
 sys/kern/subr_autoconf.c               |  33 ++------------------
 sys/sys/device.h                       |  24 +-------------
 27 files changed, 200 insertions(+), 356 deletions(-)

diffs (truncated from 1374 to 300 lines):

diff -r f126c5561056 -r 0e83436d728d sys/arch/macppc/dev/deq.c
--- a/sys/arch/macppc/dev/deq.c Tue Jun 26 04:32:35 2018 +0000
+++ b/sys/arch/macppc/dev/deq.c Tue Jun 26 06:03:57 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: deq.c,v 1.15 2018/06/18 17:07:07 thorpej Exp $ */
+/*     $NetBSD: deq.c,v 1.16 2018/06/26 06:03:57 thorpej Exp $ */
 
 /*-
  * Copyright (C) 2005 Michael Lorenz
@@ -32,7 +32,7 @@
  */
  
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: deq.c,v 1.15 2018/06/18 17:07:07 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: deq.c,v 1.16 2018/06/26 06:03:57 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -52,18 +52,13 @@
 CFATTACH_DECL_NEW(deq, sizeof(struct deq_softc),
     deq_match, deq_attach, NULL, NULL);
 
-static const char * deq_compats[] = {
-       "deq",
-       "tas3004",
-       "pcm3052",
-       "cs8416",
-       "codec",
-       NULL
-};
-
-static const struct device_compatible_entry deq_compat_data[] = {
-       DEVICE_COMPAT_ENTRY(deq_compats),
-       DEVICE_COMPAT_TERMINATOR
+static const struct device_compatible_entry compat_data[] = {
+       { "deq",                0 },
+       { "tas3004",            0 },
+       { "pcm3052",            0 },
+       { "cs8416",             0 },
+       { "codec",              0 },
+       { NULL,                 0 }
 };
 
 int
@@ -72,7 +67,7 @@
        struct i2c_attach_args *ia = aux;
        int match_result;
 
-       if (iic_use_direct_match(ia, cf, deq_compat_data, &match_result))
+       if (iic_use_direct_match(ia, cf, compat_data, &match_result))
                return match_result;
 
        /* This driver is direct-config only. */
diff -r f126c5561056 -r 0e83436d728d sys/arch/macppc/dev/smusat.c
--- a/sys/arch/macppc/dev/smusat.c      Tue Jun 26 04:32:35 2018 +0000
+++ b/sys/arch/macppc/dev/smusat.c      Tue Jun 26 06:03:57 2018 +0000
@@ -105,15 +105,10 @@
 CFATTACH_DECL_NEW(smusat, sizeof(struct smusat_softc),
     smusat_match, smusat_attach, NULL, NULL);
 
-static const char * smusat_compats[] = {
-       "sat",  
-       "smu-sat",
-       NULL
-};
-
-static const struct device_compatible_entry smusat_compat_data[] = {
-       DEVICE_COMPAT_ENTRY(smusat_compats),
-       DEVICE_COMPAT_TERMINATOR
+static const struct device_compatible_entry compat_data[] = {
+       { "sat",                0 },
+       { "smu-sat",            0 },
+       { NULL,                 0 }
 };
 
 static int
@@ -122,7 +117,7 @@
        struct i2c_attach_args *ia = aux;
        int match_result;
 
-       if (iic_use_direct_match(ia, cf, smusat_compat_data, &match_result))
+       if (iic_use_direct_match(ia, cf, compat_data, &match_result))
                return match_result;
 
        if (ia->ia_addr == 0x58)
diff -r f126c5561056 -r 0e83436d728d sys/arch/sparc64/dev/pcf8591_envctrl.c
--- a/sys/arch/sparc64/dev/pcf8591_envctrl.c    Tue Jun 26 04:32:35 2018 +0000
+++ b/sys/arch/sparc64/dev/pcf8591_envctrl.c    Tue Jun 26 06:03:57 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pcf8591_envctrl.c,v 1.8 2018/06/18 17:07:07 thorpej Exp $      */
+/*     $NetBSD: pcf8591_envctrl.c,v 1.9 2018/06/26 06:03:57 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.8 2018/06/18 17:07:07 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcf8591_envctrl.c,v 1.9 2018/06/26 06:03:57 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -69,14 +69,9 @@
 CFATTACH_DECL_NEW(ecadc, sizeof(struct ecadc_softc),
        ecadc_match, ecadc_attach, NULL, NULL);
 
-static const char * ecadc_compats[] = {
-       "ecadc",
-       NULL
-};
-
-static const struct device_compatible_entry ecadc_compat_data[] = {
-       DEVICE_COMPAT_ENTRY(ecadc_compats),
-       DEVICE_COMPAT_TERMINATOR
+static const struct device_compatible_entry compat_data[] = {
+       { "ecadc",              0 },
+       { NULL,                 0 }
 };
 
 static int
@@ -85,7 +80,7 @@
        struct i2c_attach_args *ia = aux;
        int match_result;
 
-       if (iic_use_direct_match(ia, cf, ecadc_compat_data, &match_result))
+       if (iic_use_direct_match(ia, cf, compat_data, &match_result))
                return match_result;
 
        /* This driver is direct-config only. */
diff -r f126c5561056 -r 0e83436d728d sys/dev/i2c/adadc.c
--- a/sys/dev/i2c/adadc.c       Tue Jun 26 04:32:35 2018 +0000
+++ b/sys/dev/i2c/adadc.c       Tue Jun 26 06:03:57 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: adadc.c,v 1.5 2018/06/18 17:07:07 thorpej Exp $ */
+/* $NetBSD: adadc.c,v 1.6 2018/06/26 06:03:57 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2018 Michael Lorenz
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: adadc.c,v 1.5 2018/06/18 17:07:07 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adadc.c,v 1.6 2018/06/26 06:03:57 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -93,14 +93,9 @@
 CFATTACH_DECL_NEW(adadc, sizeof(struct adadc_softc),
     adadc_match, adadc_attach, NULL, NULL);
 
-static const char * adadc_compats[] = {
-       "ad7417",
-       NULL
-};
-
-static const struct device_compatible_entry adadc_compat_data[] = {
-       DEVICE_COMPAT_ENTRY(adadc_compats),
-       DEVICE_COMPAT_TERMINATOR
+static const struct device_compatible_entry compat_data[] = {
+       { "ad7417",             0 },
+       { NULL,                 0 }
 };
 
 /* calibaration table from Darwin via Linux */
@@ -112,7 +107,7 @@
        struct i2c_attach_args *ia = aux;
        int match_result;
 
-       if (iic_use_direct_match(ia, match, adadc_compat_data, &match_result))
+       if (iic_use_direct_match(ia, match, compat_data, &match_result))
                return match_result;
 
        /*
diff -r f126c5561056 -r 0e83436d728d sys/dev/i2c/adm1021.c
--- a/sys/dev/i2c/adm1021.c     Tue Jun 26 04:32:35 2018 +0000
+++ b/sys/dev/i2c/adm1021.c     Tue Jun 26 06:03:57 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: adm1021.c,v 1.18 2018/06/18 17:07:07 thorpej Exp $ */
+/*     $NetBSD: adm1021.c,v 1.19 2018/06/26 06:03:57 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.18 2018/06/18 17:07:07 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adm1021.c,v 1.19 2018/06/26 06:03:57 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -151,16 +151,11 @@
        admtemp_match, admtemp_attach, NULL, NULL);
 
 /* XXX: add flags for compats to admtemp_setflags() */
-static const char * admtemp_compats[] = {
-       "i2c-max1617",
-       "max6642",
-       "max6690",
-       NULL
-};
-
-static const struct device_compatible_entry admtemp_compat_data[] = {
-       DEVICE_COMPAT_ENTRY(admtemp_compats),
-       DEVICE_COMPAT_TERMINATOR
+static const struct device_compatible_entry compat_data[] = {
+       { "i2c-max1617",                0 },
+       { "max6642",                    0 },
+       { "max6690",                    0 },
+       { NULL,                         0 }
 };
 
 int
@@ -169,7 +164,7 @@
        struct i2c_attach_args *ia = aux;
        int match_result;
 
-       if (iic_use_direct_match(ia, match, admtemp_compat_data, &match_result))
+       if (iic_use_direct_match(ia, match, compat_data, &match_result))
                return match_result;
        
        /*
diff -r f126c5561056 -r 0e83436d728d sys/dev/i2c/adm1026.c
--- a/sys/dev/i2c/adm1026.c     Tue Jun 26 04:32:35 2018 +0000
+++ b/sys/dev/i2c/adm1026.c     Tue Jun 26 06:03:57 2018 +0000
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: adm1026.c,v 1.4 2018/06/18 17:07:07 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adm1026.c,v 1.5 2018/06/26 06:03:57 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -122,14 +122,9 @@
 CFATTACH_DECL_NEW(adm1026hm, sizeof(struct adm1026_softc),
        adm1026_match, adm1026_attach, adm1026_detach, NULL);
 
-static const char * adm1026_compats[] = {
-       "i2c-adm1026",
-       NULL
-};
-
-static const struct device_compatible_entry adm1026_compat_data[] = {
-       DEVICE_COMPAT_ENTRY(adm1026_compats),
-       DEVICE_COMPAT_TERMINATOR
+static const struct device_compatible_entry compat_data[] = {
+       { "i2c-adm1026",                0 },
+       { NULL,                         0 }
 };
 
 static int
@@ -143,7 +138,7 @@
        sc.sc_address = ia->ia_addr;
        sc.sc_iic_flags = 0;
 
-       if (iic_use_direct_match(ia, cf, adm1026_compat_data, &match_result))
+       if (iic_use_direct_match(ia, cf, compat_data, &match_result))
                return match_result;
 
        if ((ia->ia_addr & ADM1026_ADDRMASK) == ADM1026_ADDR &&
diff -r f126c5561056 -r 0e83436d728d sys/dev/i2c/as3722.c
--- a/sys/dev/i2c/as3722.c      Tue Jun 26 04:32:35 2018 +0000
+++ b/sys/dev/i2c/as3722.c      Tue Jun 26 06:03:57 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: as3722.c,v 1.14 2018/06/18 17:07:07 thorpej Exp $ */
+/* $NetBSD: as3722.c,v 1.15 2018/06/26 06:03:57 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.14 2018/06/18 17:07:07 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: as3722.c,v 1.15 2018/06/26 06:03:57 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -222,14 +222,9 @@
     as3722reg_match, as3722reg_attach, NULL, NULL);
 #endif
 
-static const char * as3722_compats[] = {
-       "ams,as3722",
-       NULL
-};
-
-static const struct device_compatible_entry as3722_compat_data[] = {
-       DEVICE_COMPAT_ENTRY(as3722_compats),
-       DEVICE_COMPAT_TERMINATOR
+static const struct device_compatible_entry compat_data[] = {
+       { "ams,as3722",                 0 },
+       { NULL,                         0 }
 };
 
 static int
@@ -239,7 +234,7 @@



Home | Main Index | Thread Index | Old Index