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.
This commit is contained in:
parent
408f5aa571
commit
feee3a19f4
@ -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 @@ static int deq_match(device_t, struct cfdata *, void *);
|
||||
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 @@ 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_compat_data, &match_result))
|
||||
if (iic_use_direct_match(ia, cf, compat_data, &match_result))
|
||||
return match_result;
|
||||
|
||||
/* This driver is direct-config only. */
|
||||
|
@ -105,15 +105,10 @@ static int smusat_sysctl_sensor_value(SYSCTLFN_ARGS);
|
||||
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 @@ 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_compat_data, &match_result))
|
||||
if (iic_use_direct_match(ia, cf, compat_data, &match_result))
|
||||
return match_result;
|
||||
|
||||
if (ia->ia_addr == 0x58)
|
||||
|
@ -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 @@ static void ecadc_get_limits(struct sysmon_envsys *, envsys_data_t *,
|
||||
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 @@ 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_compat_data, &match_result))
|
||||
if (iic_use_direct_match(ia, cf, compat_data, &match_result))
|
||||
return match_result;
|
||||
|
||||
/* This driver is direct-config only. */
|
||||
|
@ -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 @@ static void adadc_sensors_refresh(struct sysmon_envsys *, envsys_data_t *);
|
||||
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 @@ adadc_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, adadc_compat_data, &match_result))
|
||||
if (iic_use_direct_match(ia, match, compat_data, &match_result))
|
||||
return match_result;
|
||||
|
||||
/*
|
||||
|
@ -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 @@ CFATTACH_DECL_NEW(admtemp, sizeof(struct admtemp_softc),
|
||||
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 @@ 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_compat_data, &match_result))
|
||||
if (iic_use_direct_match(ia, match, compat_data, &match_result))
|
||||
return match_result;
|
||||
|
||||
/*
|
||||
|
@ -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 @@ static int adm1026_write_reg(struct adm1026_softc *sc,
|
||||
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 @@ adm1026_match(device_t parent, cfdata_t cf, void *aux)
|
||||
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 &&
|
||||
|
@ -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>
|
||||
@ -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 @@ CFATTACH_DECL_NEW(as3722reg, sizeof(struct as3722reg_softc),
|
||||
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 @@ as3722_match(device_t parent, cfdata_t match, void *aux)
|
||||
uint8_t reg, id1;
|
||||
int error, match_result;
|
||||
|
||||
if (iic_use_direct_match(ia, match, as3722_compat_data, &match_result))
|
||||
if (iic_use_direct_match(ia, match, compat_data, &match_result))
|
||||
return match_result;
|
||||
|
||||
if (ia->ia_addr != AS3722_I2C_ADDR)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: at24cxx.c,v 1.27 2018/06/18 17:07:07 thorpej Exp $ */
|
||||
/* $NetBSD: at24cxx.c,v 1.28 2018/06/26 06:03:57 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003 Wasabi Systems, Inc.
|
||||
@ -36,7 +36,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: at24cxx.c,v 1.27 2018/06/18 17:07:07 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: at24cxx.c,v 1.28 2018/06/26 06:03:57 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -111,14 +111,6 @@ const struct cdevsw seeprom_cdevsw = {
|
||||
|
||||
static int seeprom_wait_idle(struct seeprom_softc *);
|
||||
|
||||
static const char * seeprom_compats[] = {
|
||||
"i2c-at24c64",
|
||||
"i2c-at34c02",
|
||||
"atmel,24c02",
|
||||
"atmel,24c16",
|
||||
NULL
|
||||
};
|
||||
|
||||
static const struct seeprom_size {
|
||||
const char *name;
|
||||
int size;
|
||||
@ -127,9 +119,13 @@ static const struct seeprom_size {
|
||||
{ "atmel,24c16", 2048 },
|
||||
};
|
||||
|
||||
static const struct device_compatible_entry seeprom_compat_data[] = {
|
||||
DEVICE_COMPAT_ENTRY(seeprom_compats),
|
||||
DEVICE_COMPAT_TERMINATOR
|
||||
/* XXXJRT collapse seeprom_size stuff into compat_data; see also ofw code */
|
||||
static const struct device_compatible_entry compat_data[] = {
|
||||
{ "i2c-at24c64", 0 },
|
||||
{ "i2c-at34c02", 0 },
|
||||
{ "atmel,24c02", 0 },
|
||||
{ "atmel,24c16", 0 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
static int
|
||||
@ -138,7 +134,7 @@ 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_compat_data, &match_result))
|
||||
if (iic_use_direct_match(ia, cf, compat_data, &match_result))
|
||||
return match_result;
|
||||
|
||||
if ((ia->ia_addr & AT24CXX_ADDRMASK) == AT24CXX_ADDR)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: axp20x.c,v 1.12 2018/06/18 17:07:07 thorpej Exp $ */
|
||||
/* $NetBSD: axp20x.c,v 1.13 2018/06/26 06:03:57 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2014-2017 Jared McNeill <jmcneill@invisible.ca>
|
||||
@ -29,7 +29,7 @@
|
||||
#include "opt_fdt.h"
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: axp20x.c,v 1.12 2018/06/18 17:07:07 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: axp20x.c,v 1.13 2018/06/26 06:03:57 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -214,14 +214,9 @@ static void axp20x_fdt_attach(struct axp20x_softc *);
|
||||
CFATTACH_DECL_NEW(axp20x, sizeof(struct axp20x_softc),
|
||||
axp20x_match, axp20x_attach, NULL, NULL);
|
||||
|
||||
static const char * compatible[] = {
|
||||
"x-powers,axp209",
|
||||
NULL
|
||||
};
|
||||
|
||||
static const struct device_compatible_entry axp20x_compat_data[] = {
|
||||
DEVICE_COMPAT_ENTRY(compatible),
|
||||
DEVICE_COMPAT_TERMINATOR
|
||||
static const struct device_compatible_entry compat_data[] = {
|
||||
{ "x-powers,axp209", 0 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
static int
|
||||
@ -230,7 +225,7 @@ axp20x_match(device_t parent, cfdata_t match, void *aux)
|
||||
struct i2c_attach_args * const ia = aux;
|
||||
int match_result;
|
||||
|
||||
if (iic_use_direct_match(ia, match, axp20x_compat_data, &match_result))
|
||||
if (iic_use_direct_match(ia, match, compat_data, &match_result))
|
||||
return match_result;
|
||||
|
||||
/* This device is direct-config only. */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: axp22x.c,v 1.5 2018/06/18 17:07:07 thorpej Exp $ */
|
||||
/* $NetBSD: axp22x.c,v 1.6 2018/06/26 06:03:57 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2014 Jared D. McNeill <jmcneill@invisible.ca>
|
||||
@ -27,7 +27,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: axp22x.c,v 1.5 2018/06/18 17:07:07 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: axp22x.c,v 1.6 2018/06/26 06:03:57 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -40,14 +40,9 @@ __KERNEL_RCSID(0, "$NetBSD: axp22x.c,v 1.5 2018/06/18 17:07:07 thorpej Exp $");
|
||||
|
||||
#include <dev/sysmon/sysmonvar.h>
|
||||
|
||||
static const char *compatible[] = {
|
||||
"x-powers,axp221",
|
||||
NULL
|
||||
};
|
||||
|
||||
static const struct device_compatible_entry axp22x_compat_data[] = {
|
||||
DEVICE_COMPAT_ENTRY(compatible),
|
||||
DEVICE_COMPAT_TERMINATOR
|
||||
static const struct device_compatible_entry compat_data[] = {
|
||||
{ "x-powers,axp221", 0 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
#define AXP_TEMP_MON_REG 0x56 /* 2 bytes */
|
||||
@ -76,7 +71,7 @@ axp22x_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, axp22x_compat_data, &match_result))
|
||||
if (iic_use_direct_match(ia, match, compat_data, &match_result))
|
||||
return match_result;
|
||||
|
||||
/* This device is direct-config only. */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: axppmic.c,v 1.13 2018/06/26 04:32:35 thorpej Exp $ */
|
||||
/* $NetBSD: axppmic.c,v 1.14 2018/06/26 06:03:57 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2014-2018 Jared McNeill <jmcneill@invisible.ca>
|
||||
@ -27,7 +27,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: axppmic.c,v 1.13 2018/06/26 04:32:35 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: axppmic.c,v 1.14 2018/06/26 06:03:57 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -264,7 +264,6 @@ struct axpreg_attach_args {
|
||||
i2c_addr_t reg_addr;
|
||||
};
|
||||
|
||||
static const char *axp803_compatstrings[] = { "x-powers,axp803", NULL };
|
||||
static const struct axppmic_config axp803_config = {
|
||||
.name = "AXP803",
|
||||
.controls = axp803_ctrls,
|
||||
@ -283,8 +282,6 @@ static const struct axppmic_config axp803_config = {
|
||||
.chargestirq = AXPPMIC_IRQ(4, __BITS(1,0)),
|
||||
};
|
||||
|
||||
static const char *axp805_compatstrings[] = { "x-powers,axp805",
|
||||
"x-powers,axp806", NULL };
|
||||
static const struct axppmic_config axp805_config = {
|
||||
.name = "AXP805/806",
|
||||
.controls = axp805_ctrls,
|
||||
@ -293,10 +290,11 @@ static const struct axppmic_config axp805_config = {
|
||||
.poklirq = AXPPMIC_IRQ(2, __BIT(0)),
|
||||
};
|
||||
|
||||
static const struct device_compatible_entry axppmic_compat_data[] = {
|
||||
DEVICE_COMPAT_ENTRY_WITH_DATA(axp803_compatstrings, &axp803_config),
|
||||
DEVICE_COMPAT_ENTRY_WITH_DATA(axp805_compatstrings, &axp805_config),
|
||||
DEVICE_COMPAT_TERMINATOR
|
||||
static const struct device_compatible_entry compat_data[] = {
|
||||
{ "x-powers,axp803", (uintptr_t)&axp803_config },
|
||||
{ "x-powers,axp805", (uintptr_t)&axp805_config },
|
||||
{ "x-powers,axp806", (uintptr_t)&axp805_config },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
static int
|
||||
@ -682,7 +680,7 @@ axppmic_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, axppmic_compat_data, &match_result))
|
||||
if (iic_use_direct_match(ia, match, compat_data, &match_result))
|
||||
return match_result;
|
||||
|
||||
/* This device is direct-config only. */
|
||||
@ -702,9 +700,9 @@ axppmic_attach(device_t parent, device_t self, void *aux)
|
||||
uint32_t irq_mask;
|
||||
void *ih;
|
||||
|
||||
(void) iic_compatible_match(ia, axppmic_compat_data, &dce);
|
||||
(void) iic_compatible_match(ia, compat_data, &dce);
|
||||
KASSERT(dce != NULL);
|
||||
c = DEVICE_COMPAT_ENTRY_GET_PTR(dce);
|
||||
c = (void *)dce->data;
|
||||
|
||||
sc->sc_dev = self;
|
||||
sc->sc_i2c = ia->ia_tag;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dbcool.c,v 1.51 2018/06/22 15:48:57 martin Exp $ */
|
||||
/* $NetBSD: dbcool.c,v 1.52 2018/06/26 06:03:57 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
@ -50,7 +50,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: dbcool.c,v 1.51 2018/06/22 15:48:57 martin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: dbcool.c,v 1.52 2018/06/26 06:03:57 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -731,17 +731,12 @@ static char dbcool_cur_behav[16];
|
||||
CFATTACH_DECL_NEW(dbcool, sizeof(struct dbcool_softc),
|
||||
dbcool_match, dbcool_attach, dbcool_detach, NULL);
|
||||
|
||||
static const char * dbcool_compats[] = {
|
||||
"i2c-adm1031",
|
||||
"adt7467",
|
||||
"adt7460",
|
||||
"adm1030",
|
||||
NULL
|
||||
};
|
||||
|
||||
static const struct device_compatible_entry dbcool_compat_data[] = {
|
||||
DEVICE_COMPAT_ENTRY(dbcool_compats),
|
||||
DEVICE_COMPAT_TERMINATOR
|
||||
static const struct device_compatible_entry compat_data[] = {
|
||||
{ "i2c-adm1031", 0 },
|
||||
{ "adt7467", 0 },
|
||||
{ "adt7460", 0 },
|
||||
{ "adm1030", 0 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
int
|
||||
@ -756,7 +751,7 @@ dbcool_match(device_t parent, cfdata_t cf, void *aux)
|
||||
dc.dc_writereg = dbcool_writereg;
|
||||
int match_result;
|
||||
|
||||
if (iic_use_direct_match(ia, cf, dbcool_compat_data, &match_result))
|
||||
if (iic_use_direct_match(ia, cf, compat_data, &match_result))
|
||||
return match_result;
|
||||
|
||||
if ((ia->ia_addr & DBCOOL_ADDRMASK) != DBCOOL_ADDR)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ds1307.c,v 1.28 2018/06/26 04:32:35 thorpej Exp $ */
|
||||
/* $NetBSD: ds1307.c,v 1.29 2018/06/26 06:03:57 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003 Wasabi Systems, Inc.
|
||||
@ -36,7 +36,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ds1307.c,v 1.28 2018/06/26 04:32:35 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ds1307.c,v 1.29 2018/06/26 06:03:57 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -75,7 +75,6 @@ struct dsrtc_model {
|
||||
#define DSRTC_FLAG_CLOCK_HOLD_REVERSED 0x20
|
||||
};
|
||||
|
||||
static const char *ds1307_compats[] = { "dallas,ds1307", "maxim,ds1307", NULL };
|
||||
static const i2c_addr_t ds1307_valid_addrs[] = { DS1307_ADDR, 0 };
|
||||
static const struct dsrtc_model ds1307_model = {
|
||||
.dm_valid_addrs = ds1307_valid_addrs,
|
||||
@ -89,7 +88,6 @@ static const struct dsrtc_model ds1307_model = {
|
||||
.dm_flags = DSRTC_FLAG_BCD | DSRTC_FLAG_CLOCK_HOLD,
|
||||
};
|
||||
|
||||
static const char *ds1339_compats[] = { "dallas,ds1339", "maxim,ds1339", NULL };
|
||||
static const struct dsrtc_model ds1339_model = {
|
||||
.dm_valid_addrs = ds1307_valid_addrs,
|
||||
.dm_model = 1339,
|
||||
@ -98,7 +96,6 @@ static const struct dsrtc_model ds1339_model = {
|
||||
.dm_flags = DSRTC_FLAG_BCD,
|
||||
};
|
||||
|
||||
static const char *ds1340_compats[] = { "dallas,ds1340", "maxim,ds1340", NULL };
|
||||
static const struct dsrtc_model ds1340_model = {
|
||||
.dm_valid_addrs = ds1307_valid_addrs,
|
||||
.dm_model = 1340,
|
||||
@ -109,7 +106,6 @@ static const struct dsrtc_model ds1340_model = {
|
||||
.dm_flags = DSRTC_FLAG_BCD,
|
||||
};
|
||||
|
||||
static const char *ds1672_compats[] = { "dallas,ds1672", "maxim,ds1672", NULL };
|
||||
static const struct dsrtc_model ds1672_model = {
|
||||
.dm_valid_addrs = ds1307_valid_addrs,
|
||||
.dm_model = 1672,
|
||||
@ -120,7 +116,6 @@ static const struct dsrtc_model ds1672_model = {
|
||||
.dm_flags = 0,
|
||||
};
|
||||
|
||||
static const char *ds3231_compats[] = { "dallas,ds3231", "maxim,ds3231", NULL };
|
||||
static const struct dsrtc_model ds3231_model = {
|
||||
.dm_valid_addrs = ds1307_valid_addrs,
|
||||
.dm_model = 3231,
|
||||
@ -129,7 +124,6 @@ static const struct dsrtc_model ds3231_model = {
|
||||
.dm_flags = DSRTC_FLAG_BCD | DSRTC_FLAG_TEMP,
|
||||
};
|
||||
|
||||
static const char *ds3232_compats[] = { "dallas,ds3232", "maxim,ds3232", NULL };
|
||||
static const struct dsrtc_model ds3232_model = {
|
||||
.dm_valid_addrs = ds1307_valid_addrs,
|
||||
.dm_model = 3232,
|
||||
@ -145,8 +139,6 @@ static const struct dsrtc_model ds3232_model = {
|
||||
.dm_flags = DSRTC_FLAG_BCD,
|
||||
};
|
||||
|
||||
/* XXX vendor prefix */
|
||||
static const char *mcp7940_compats[] = { "microchip,mcp7940", NULL };
|
||||
static const i2c_addr_t mcp7940_valid_addrs[] = { MCP7940_ADDR, 0 };
|
||||
static const struct dsrtc_model mcp7940_model = {
|
||||
.dm_valid_addrs = mcp7940_valid_addrs,
|
||||
@ -163,15 +155,28 @@ static const struct dsrtc_model mcp7940_model = {
|
||||
DSRTC_FLAG_VBATEN | DSRTC_FLAG_CLOCK_HOLD_REVERSED,
|
||||
};
|
||||
|
||||
static const struct device_compatible_entry dsrtc_compat_data[] = {
|
||||
DEVICE_COMPAT_ENTRY_WITH_DATA(ds1307_compats, &ds1307_model),
|
||||
DEVICE_COMPAT_ENTRY_WITH_DATA(ds1339_compats, &ds1339_model),
|
||||
DEVICE_COMPAT_ENTRY_WITH_DATA(ds1340_compats, &ds1340_model),
|
||||
DEVICE_COMPAT_ENTRY_WITH_DATA(ds1672_compats, &ds1672_model),
|
||||
DEVICE_COMPAT_ENTRY_WITH_DATA(ds3231_compats, &ds3231_model),
|
||||
DEVICE_COMPAT_ENTRY_WITH_DATA(ds3232_compats, &ds3232_model),
|
||||
DEVICE_COMPAT_ENTRY_WITH_DATA(mcp7940_compats, &mcp7940_model),
|
||||
DEVICE_COMPAT_TERMINATOR
|
||||
static const struct device_compatible_entry compat_data[] = {
|
||||
{ "dallas,ds1307", (uintptr_t)&ds1307_model },
|
||||
{ "maxim,ds1307", (uintptr_t)&ds1307_model },
|
||||
|
||||
{ "dallas,ds1339", (uintptr_t)&ds1339_model },
|
||||
{ "maxim,ds1339", (uintptr_t)&ds1339_model },
|
||||
|
||||
{ "dallas,ds1340", (uintptr_t)&ds1340_model },
|
||||
{ "maxim,ds1340", (uintptr_t)&ds1340_model },
|
||||
|
||||
{ "dallas,ds1672", (uintptr_t)&ds1672_model },
|
||||
{ "maxim,ds1672", (uintptr_t)&ds1672_model },
|
||||
|
||||
{ "dallas,ds3231", (uintptr_t)&ds3231_model },
|
||||
{ "maxim,ds3231", (uintptr_t)&ds3231_model },
|
||||
|
||||
{ "dallas,ds3232", (uintptr_t)&ds3232_model },
|
||||
{ "maxim,ds3232", (uintptr_t)&ds3232_model },
|
||||
|
||||
{ "microchip,mcp7940", (uintptr_t)&mcp7940_model },
|
||||
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
struct dsrtc_softc {
|
||||
@ -234,9 +239,8 @@ dsrtc_model_by_number(u_int model)
|
||||
if (model == 0)
|
||||
return &ds1307_model;
|
||||
|
||||
for (dce = dsrtc_compat_data;
|
||||
DEVICE_COMPAT_ENTRY_IS_TERMINATOR(dce) == false; dce++) {
|
||||
dm = DEVICE_COMPAT_ENTRY_GET_PTR(dce);
|
||||
for (dce = compat_data; dce->compat != NULL; dce++) {
|
||||
dm = (void *)dce->data;
|
||||
if (dm->dm_model == model)
|
||||
return dm;
|
||||
}
|
||||
@ -249,8 +253,8 @@ dsrtc_model_by_compat(const struct i2c_attach_args *ia)
|
||||
const struct dsrtc_model *dm = NULL;
|
||||
const struct device_compatible_entry *dce;
|
||||
|
||||
if (iic_compatible_match(ia, dsrtc_compat_data, &dce))
|
||||
dm = DEVICE_COMPAT_ENTRY_GET_PTR(dce);
|
||||
if (iic_compatible_match(ia, compat_data, &dce))
|
||||
dm = (void *)dce->data;
|
||||
|
||||
return dm;
|
||||
}
|
||||
@ -273,7 +277,7 @@ dsrtc_match(device_t parent, cfdata_t cf, void *arg)
|
||||
const struct dsrtc_model *dm;
|
||||
int match_result;
|
||||
|
||||
if (iic_use_direct_match(ia, cf, dsrtc_compat_data, &match_result))
|
||||
if (iic_use_direct_match(ia, cf, compat_data, &match_result))
|
||||
return match_result;
|
||||
|
||||
dm = dsrtc_model_by_number(cf->cf_flags & 0xffff);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dstemp.c,v 1.3 2018/06/18 17:07:07 thorpej Exp $ */
|
||||
/* $NetBSD: dstemp.c,v 1.4 2018/06/26 06:03:57 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2018 Michael Lorenz
|
||||
@ -27,7 +27,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: dstemp.c,v 1.3 2018/06/18 17:07:07 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: dstemp.c,v 1.4 2018/06/26 06:03:57 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -72,14 +72,9 @@ static void dstemp_sensors_refresh(struct sysmon_envsys *, envsys_data_t *);
|
||||
CFATTACH_DECL_NEW(dstemp, sizeof(struct dstemp_softc),
|
||||
dstemp_match, dstemp_attach, NULL, NULL);
|
||||
|
||||
static const char * dstemp_compats[] = {
|
||||
"ds1631",
|
||||
NULL
|
||||
};
|
||||
|
||||
static const struct device_compatible_entry dstemp_compat_data[] = {
|
||||
DEVICE_COMPAT_ENTRY(dstemp_compats),
|
||||
DEVICE_COMPAT_TERMINATOR
|
||||
static const struct device_compatible_entry compat_data[] = {
|
||||
{ "ds1631", 0 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
static int
|
||||
@ -88,7 +83,7 @@ dstemp_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, dstemp_compat_data, &match_result))
|
||||
if (iic_use_direct_match(ia, match, compat_data, &match_result))
|
||||
return match_result;
|
||||
|
||||
if ((ia->ia_addr & 0xf8) == 0x48)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: fcu.c,v 1.5 2018/06/18 17:07:07 thorpej Exp $ */
|
||||
/* $NetBSD: fcu.c,v 1.6 2018/06/26 06:03:57 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2018 Michael Lorenz
|
||||
@ -27,7 +27,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: fcu.c,v 1.5 2018/06/18 17:07:07 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: fcu.c,v 1.6 2018/06/26 06:03:57 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -115,14 +115,9 @@ static void fcu_adjust(void *);
|
||||
CFATTACH_DECL_NEW(fcu, sizeof(struct fcu_softc),
|
||||
fcu_match, fcu_attach, NULL, NULL);
|
||||
|
||||
static const char * fcu_compats[] = {
|
||||
"fcu",
|
||||
NULL
|
||||
};
|
||||
|
||||
static const struct device_compatible_entry fcu_compat_data[] = {
|
||||
DEVICE_COMPAT_ENTRY(fcu_compats),
|
||||
DEVICE_COMPAT_TERMINATOR
|
||||
static const struct device_compatible_entry compat_data[] = {
|
||||
{ "fcu", 0 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
static int
|
||||
@ -131,7 +126,7 @@ fcu_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, fcu_compat_data, &match_result))
|
||||
if (iic_use_direct_match(ia, match, compat_data, &match_result))
|
||||
return match_result;
|
||||
|
||||
if (ia->ia_addr == 0x2f)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ihidev.c,v 1.4 2018/06/18 17:07:07 thorpej Exp $ */
|
||||
/* $NetBSD: ihidev.c,v 1.5 2018/06/26 06:03:57 thorpej Exp $ */
|
||||
/* $OpenBSD ihidev.c,v 1.13 2017/04/08 02:57:23 deraadt Exp $ */
|
||||
|
||||
/*-
|
||||
@ -54,7 +54,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ihidev.c,v 1.4 2018/06/18 17:07:07 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ihidev.c,v 1.5 2018/06/26 06:03:57 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -120,14 +120,9 @@ static int ihidev_maxrepid(void *, int);
|
||||
static int ihidev_print(void *, const char *);
|
||||
static int ihidev_submatch(device_t, cfdata_t, const int *, void *);
|
||||
|
||||
static const char *ihidev_compats[] = {
|
||||
"hid-over-i2c",
|
||||
NULL
|
||||
};
|
||||
|
||||
static const struct device_compatible_entry ihidev_compat_data[] = {
|
||||
DEVICE_COMPAT_ENTRY(ihidev_compats),
|
||||
DEVICE_COMPAT_TERMINATOR
|
||||
static const struct device_compatible_entry compat_data[] = {
|
||||
{ "hid-over-i2c", 0 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
static int
|
||||
@ -136,7 +131,7 @@ ihidev_match(device_t parent, cfdata_t match, void *aux)
|
||||
struct i2c_attach_args * const ia = aux;
|
||||
int match_result;
|
||||
|
||||
if (iic_use_direct_match(ia, match, ihidev_compat_data, &match_result))
|
||||
if (iic_use_direct_match(ia, match, compat_data, &match_result))
|
||||
return I2C_MATCH_DIRECT_COMPATIBLE;
|
||||
|
||||
return 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lm75.c,v 1.32 2018/06/18 17:07:07 thorpej Exp $ */
|
||||
/* $NetBSD: lm75.c,v 1.33 2018/06/26 06:03:57 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003 Wasabi Systems, Inc.
|
||||
@ -36,7 +36,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: lm75.c,v 1.32 2018/06/18 17:07:07 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lm75.c,v 1.33 2018/06/26 06:03:57 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -101,19 +101,14 @@ static void lmtemp_setlim_lm77(struct sysmon_envsys *, envsys_data_t *,
|
||||
static void lmtemp_setup_sysctl(struct lmtemp_softc *);
|
||||
static int sysctl_lm75_temp(SYSCTLFN_ARGS);
|
||||
|
||||
static const char * lmtemp_compats[] = {
|
||||
"i2c-lm75",
|
||||
"ds1775",
|
||||
static const struct device_compatible_entry compat_data[] = {
|
||||
{ "i2c-lm75", 0 },
|
||||
{ "ds1775", 0 },
|
||||
/*
|
||||
* see XXX in _attach() below: add code once non-lm75 matches are
|
||||
* added here!
|
||||
*/
|
||||
NULL
|
||||
};
|
||||
|
||||
static const struct device_compatible_entry lmtemp_compat_data[] = {
|
||||
DEVICE_COMPAT_ENTRY(lmtemp_compats),
|
||||
DEVICE_COMPAT_TERMINATOR
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
enum {
|
||||
@ -153,7 +148,7 @@ lmtemp_match(device_t parent, cfdata_t cf, void *aux)
|
||||
struct i2c_attach_args *ia = aux;
|
||||
int i, match_result;
|
||||
|
||||
if (iic_use_direct_match(ia, cf, lmtemp_compat_data, &match_result))
|
||||
if (iic_use_direct_match(ia, cf, compat_data, &match_result))
|
||||
return match_result;
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lm87.c,v 1.9 2018/06/18 17:07:07 thorpej Exp $ */
|
||||
/* $NetBSD: lm87.c,v 1.10 2018/06/26 06:03:57 thorpej Exp $ */
|
||||
/* $OpenBSD: lm87.c,v 1.20 2008/11/10 05:19:48 cnst Exp $ */
|
||||
|
||||
/*
|
||||
@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: lm87.c,v 1.9 2018/06/18 17:07:07 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lm87.c,v 1.10 2018/06/26 06:03:57 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -135,18 +135,13 @@ void lmenv_refresh(struct sysmon_envsys *, envsys_data_t *);
|
||||
CFATTACH_DECL_NEW(lmenv, sizeof(struct lmenv_softc),
|
||||
lmenv_match, lmenv_attach, NULL, NULL);
|
||||
|
||||
static const char * lmenv_compats[] = {
|
||||
"lm87",
|
||||
"lm87cimt",
|
||||
"adm9240",
|
||||
"lm81",
|
||||
"ds1780",
|
||||
NULL
|
||||
};
|
||||
|
||||
static const struct device_compatible_entry lmenv_compat_data[] = {
|
||||
DEVICE_COMPAT_ENTRY(lmenv_compats),
|
||||
DEVICE_COMPAT_TERMINATOR,
|
||||
static const struct device_compatible_entry compat_data[] = {
|
||||
{ "lm87", 0 },
|
||||
{ "lm87cimt", 0 },
|
||||
{ "adm9240", 0 },
|
||||
{ "lm81", 0 },
|
||||
{ "ds1780", 0 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
int
|
||||
@ -156,7 +151,7 @@ lmenv_match(device_t parent, cfdata_t match, void *aux)
|
||||
u_int8_t cmd, val;
|
||||
int error, i, match_result;
|
||||
|
||||
if (iic_use_direct_match(ia, match, lmenv_compat_data, &match_result))
|
||||
if (iic_use_direct_match(ia, match, compat_data, &match_result))
|
||||
return match_result;
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: max77620.c,v 1.5 2018/06/18 17:07:07 thorpej Exp $ */
|
||||
/* $NetBSD: max77620.c,v 1.6 2018/06/26 06:03:57 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2017 Jared McNeill <jmcneill@invisible.ca>
|
||||
@ -27,7 +27,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: max77620.c,v 1.5 2018/06/18 17:07:07 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: max77620.c,v 1.6 2018/06/26 06:03:57 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -66,14 +66,9 @@ struct max77620_pin {
|
||||
bool pin_actlo;
|
||||
};
|
||||
|
||||
static const char * max77620_compats[] = {
|
||||
"maxim,max77620",
|
||||
NULL
|
||||
};
|
||||
|
||||
static const struct device_compatible_entry max77620_compat_data[] = {
|
||||
DEVICE_COMPAT_ENTRY(max77620_compats),
|
||||
DEVICE_COMPAT_TERMINATOR
|
||||
static const struct device_compatible_entry compat_data[] = {
|
||||
{ "maxim,max77620", 0 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
static uint8_t
|
||||
@ -265,8 +260,7 @@ max77620_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, max77620_compat_data,
|
||||
&match_result))
|
||||
if (iic_use_direct_match(ia, match, compat_data, &match_result))
|
||||
return match_result;
|
||||
|
||||
return 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pcf8563.c,v 1.10 2018/06/18 17:07:07 thorpej Exp $ */
|
||||
/* $NetBSD: pcf8563.c,v 1.11 2018/06/26 06:03:57 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011 Jonathan A. Kollasch
|
||||
@ -32,7 +32,7 @@
|
||||
#endif
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: pcf8563.c,v 1.10 2018/06/18 17:07:07 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pcf8563.c,v 1.11 2018/06/26 06:03:57 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -48,15 +48,10 @@ __KERNEL_RCSID(0, "$NetBSD: pcf8563.c,v 1.10 2018/06/18 17:07:07 thorpej Exp $")
|
||||
#include <dev/fdt/fdtvar.h>
|
||||
#endif
|
||||
|
||||
static const char *compatible[] = {
|
||||
"nxp,pcf8563",
|
||||
"pcf8563rtc",
|
||||
NULL
|
||||
};
|
||||
|
||||
static const struct device_compatible_entry pcf8563rtc_compat_data[] = {
|
||||
DEVICE_COMPAT_ENTRY(compatible),
|
||||
DEVICE_COMPAT_TERMINATOR
|
||||
static const struct device_compatible_entry compat_data[] = {
|
||||
{ "nxp,pcf8563", 0 },
|
||||
{ "pcf8563rtc", 0 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
struct pcf8563rtc_softc {
|
||||
@ -83,7 +78,7 @@ pcf8563rtc_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, pcf8563rtc_compat_data, &match_result))
|
||||
if (iic_use_direct_match(ia, cf, compat_data, &match_result))
|
||||
return match_result;
|
||||
|
||||
/* indirect config - check typical address */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sy8106a.c,v 1.3 2018/06/18 17:07:07 thorpej Exp $ */
|
||||
/* $NetBSD: sy8106a.c,v 1.4 2018/06/26 06:03:57 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2017 Jared McNeill <jmcneill@invisible.ca>
|
||||
@ -27,7 +27,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: sy8106a.c,v 1.3 2018/06/18 17:07:07 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: sy8106a.c,v 1.4 2018/06/26 06:03:57 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -59,14 +59,9 @@ struct sy8106a_softc {
|
||||
u_int sc_ramp_delay;
|
||||
};
|
||||
|
||||
static const char * compatible[] = {
|
||||
"silergy,sy8106a",
|
||||
NULL
|
||||
};
|
||||
|
||||
static const struct device_compatible_entry sy8106a_compat_data[] = {
|
||||
DEVICE_COMPAT_ENTRY(compatible),
|
||||
DEVICE_COMPAT_TERMINATOR
|
||||
static const struct device_compatible_entry compat_data[] = {
|
||||
{ "silergy,sy8106a", 0 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
static uint8_t
|
||||
@ -192,7 +187,7 @@ sy8106a_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, sy8106a_compat_data, &match_result))
|
||||
if (iic_use_direct_match(ia, match, compat_data, &match_result))
|
||||
return match_result;
|
||||
|
||||
return 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: tcagpio.c,v 1.3 2018/06/18 17:07:07 thorpej Exp $ */
|
||||
/* $NetBSD: tcagpio.c,v 1.4 2018/06/26 06:03:57 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2017 Jared McNeill <jmcneill@invisible.ca>
|
||||
@ -27,7 +27,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: tcagpio.c,v 1.3 2018/06/18 17:07:07 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: tcagpio.c,v 1.4 2018/06/26 06:03:57 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -68,14 +68,9 @@ struct tcagpio_pin {
|
||||
bool pin_actlo;
|
||||
};
|
||||
|
||||
static const char * compatible[] = {
|
||||
"ti,tca9539",
|
||||
NULL
|
||||
};
|
||||
|
||||
static const struct device_compatible_entry tcagpio_compat_data[] = {
|
||||
DEVICE_COMPAT_ENTRY(compatible),
|
||||
DEVICE_COMPAT_TERMINATOR
|
||||
static const struct device_compatible_entry compat_data[] = {
|
||||
{ "ti,tca9539", 0 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
static uint8_t
|
||||
@ -253,7 +248,7 @@ tcagpio_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, tcagpio_compat_data, &match_result))
|
||||
if (iic_use_direct_match(ia, match, compat_data, &match_result))
|
||||
return match_result;
|
||||
|
||||
return 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: tcakp.c,v 1.8 2018/06/18 17:07:07 thorpej Exp $ */
|
||||
/* $NetBSD: tcakp.c,v 1.9 2018/06/26 06:03:57 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2017 Jared McNeill <jmcneill@invisible.ca>
|
||||
@ -29,7 +29,7 @@
|
||||
#include "opt_fdt.h"
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: tcakp.c,v 1.8 2018/06/18 17:07:07 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: tcakp.c,v 1.9 2018/06/26 06:03:57 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -113,14 +113,9 @@ static int tcakp_write(struct tcakp_softc *, uint8_t, uint8_t);
|
||||
CFATTACH_DECL_NEW(tcakp, sizeof(struct tcakp_softc),
|
||||
tcakp_match, tcakp_attach, NULL, NULL);
|
||||
|
||||
static const char * tcakp_compats[] = {
|
||||
"ti,tca8418",
|
||||
NULL
|
||||
};
|
||||
|
||||
static const struct device_compatible_entry tcakp_compat_data[] = {
|
||||
DEVICE_COMPAT_ENTRY(tcakp_compats),
|
||||
DEVICE_COMPAT_TERMINATOR
|
||||
static const struct device_compatible_entry compat_data[] = {
|
||||
{ "ti,tca8418", 0 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
static u_int
|
||||
@ -323,7 +318,7 @@ tcakp_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, tcakp_compat_data, &match_result))
|
||||
if (iic_use_direct_match(ia, match, compat_data, &match_result))
|
||||
return match_result;
|
||||
|
||||
if (ia->ia_addr == 0x34)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: titemp.c,v 1.6 2018/06/18 17:07:07 thorpej Exp $ */
|
||||
/* $NetBSD: titemp.c,v 1.7 2018/06/26 06:03:57 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca>
|
||||
@ -27,7 +27,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: titemp.c,v 1.6 2018/06/18 17:07:07 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: titemp.c,v 1.7 2018/06/26 06:03:57 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -84,14 +84,9 @@ static int titemp_read(struct titemp_softc *, uint8_t, uint8_t *);
|
||||
CFATTACH_DECL_NEW(titemp, sizeof(struct titemp_softc),
|
||||
titemp_match, titemp_attach, NULL, NULL);
|
||||
|
||||
static const char * titemp_compats[] = {
|
||||
"ti,tmp451",
|
||||
NULL
|
||||
};
|
||||
|
||||
static const struct device_compatible_entry titemp_compat_data[] = {
|
||||
DEVICE_COMPAT_ENTRY(titemp_compats),
|
||||
DEVICE_COMPAT_TERMINATOR
|
||||
static const struct device_compatible_entry compat_data[] = {
|
||||
{ "ti,tmp451", 0 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
static int
|
||||
@ -101,7 +96,7 @@ titemp_match(device_t parent, cfdata_t match, void *aux)
|
||||
uint8_t mfid;
|
||||
int error, match_result;
|
||||
|
||||
if (iic_use_direct_match(ia, match, titemp_compat_data, &match_result))
|
||||
if (iic_use_direct_match(ia, match, compat_data, &match_result))
|
||||
return match_result;
|
||||
|
||||
if (ia->ia_addr != 0x4c)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: tsl256x.c,v 1.5 2018/06/18 17:07:07 thorpej Exp $ */
|
||||
/* $NetBSD: tsl256x.c,v 1.6 2018/06/26 06:03:57 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2018 Jason R. Thorpe
|
||||
@ -27,7 +27,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: tsl256x.c,v 1.5 2018/06/18 17:07:07 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: tsl256x.c,v 1.6 2018/06/26 06:03:57 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -78,15 +78,10 @@ static void tsllux_attach(device_t, device_t, void *);
|
||||
CFATTACH_DECL_NEW(tsllux, sizeof(struct tsllux_softc),
|
||||
tsllux_match, tsllux_attach, NULL, NULL);
|
||||
|
||||
static const char *tsllux_compats[] = {
|
||||
"amstaos,tsl2560",
|
||||
"amstaos,tsl2561",
|
||||
NULL
|
||||
};
|
||||
|
||||
static const struct device_compatible_entry tsllux_compat_data[] = {
|
||||
DEVICE_COMPAT_ENTRY(tsllux_compats),
|
||||
DEVICE_COMPAT_TERMINATOR
|
||||
{ "amstaos,tsl2560", 0 },
|
||||
{ "amstaos,tsl2561", 0 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
static int tsllux_read1(struct tsllux_softc *, uint8_t, uint8_t *);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: subr_autoconf.c,v 1.261 2018/06/26 04:32:35 thorpej Exp $ */
|
||||
/* $NetBSD: subr_autoconf.c,v 1.262 2018/06/26 06:03:57 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996, 2000 Christopher G. Demetriou
|
||||
@ -77,7 +77,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.261 2018/06/26 04:32:35 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.262 2018/06/26 06:03:57 thorpej Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_ddb.h"
|
||||
@ -2274,29 +2274,6 @@ device_find_by_driver_unit(const char *name, int unit)
|
||||
return device_lookup(cd, unit);
|
||||
}
|
||||
|
||||
/*
|
||||
* device_compatible_entry_matches:
|
||||
*
|
||||
* Helper function to determine if a device_compatible_entry
|
||||
* contains a match for the specified "compatible" string.
|
||||
*/
|
||||
static bool
|
||||
device_compatible_entry_matches(const struct device_compatible_entry *dce,
|
||||
const char *compatible)
|
||||
{
|
||||
const char **cpp = DEVICE_COMPAT_ENTRY_GET_STRINGS(dce);
|
||||
|
||||
if (dce == NULL || cpp == NULL)
|
||||
return false;
|
||||
|
||||
for (; *cpp != NULL; cpp++) {
|
||||
if (strcmp(*cpp, compatible) == 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* device_compatible_match:
|
||||
*
|
||||
@ -2324,10 +2301,8 @@ device_compatible_match(const char **device_compats, int ndevice_compats,
|
||||
for (i = 0, match_weight = ndevice_compats - 1;
|
||||
i < ndevice_compats;
|
||||
i++, match_weight--) {
|
||||
for (dce = driver_compats;
|
||||
DEVICE_COMPAT_ENTRY_IS_TERMINATOR(dce) == false; dce++) {
|
||||
if (device_compatible_entry_matches(dce,
|
||||
device_compats[i])) {
|
||||
for (dce = driver_compats; dce->compat != NULL; dce++) {
|
||||
if (strcmp(dce->compat, device_compats[i]) == 0) {
|
||||
KASSERT(match_weight >= 0);
|
||||
if (matching_entryp)
|
||||
*matching_entryp = dce;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: device.h,v 1.154 2018/06/26 04:32:35 thorpej Exp $ */
|
||||
/* $NetBSD: device.h,v 1.155 2018/06/26 06:03:57 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996, 2000 Christopher G. Demetriou
|
||||
@ -124,27 +124,9 @@ typedef struct cfattach *cfattach_t;
|
||||
|
||||
#if defined(_KERNEL) || defined(_KMEMUSER)
|
||||
struct device_compatible_entry {
|
||||
const char ** dce_compat_strings;
|
||||
union {
|
||||
uintptr_t dceu_val;
|
||||
const void *dceu_ptr;
|
||||
} dce_un;
|
||||
const char *compat;
|
||||
uintptr_t data;
|
||||
};
|
||||
#define DEVICE_COMPAT_ENTRY_WITH_DATA(strings, opaque) \
|
||||
{ .dce_compat_strings = (strings), \
|
||||
.dce_un.dceu_val = (uintptr_t)(opaque) }
|
||||
|
||||
#define DEVICE_COMPAT_ENTRY(strings) \
|
||||
DEVICE_COMPAT_ENTRY_WITH_DATA(strings, 0)
|
||||
|
||||
#define DEVICE_COMPAT_TERMINATOR \
|
||||
{ .dce_compat_strings = NULL }
|
||||
|
||||
#define DEVICE_COMPAT_ENTRY_GET_STRINGS(_dce) ((_dce)->dce_compat_strings)
|
||||
#define DEVICE_COMPAT_ENTRY_GET_NUM(_dce) ((_dce)->dce_un.dceu_val)
|
||||
#define DEVICE_COMPAT_ENTRY_GET_PTR(_dce) ((_dce)->dce_un.dceu_ptr)
|
||||
#define DEVICE_COMPAT_ENTRY_IS_TERMINATOR(_dce) \
|
||||
(((_dce) == NULL || (_dce)->dce_compat_strings == NULL) ? true : false)
|
||||
|
||||
struct device_lock {
|
||||
int dvl_nwait;
|
||||
|
Loading…
Reference in New Issue
Block a user