summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2005-12-27 17:18:19 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2005-12-27 17:18:19 +0000
commit4bbbc10fd4639be17d042362a32260e0b6cd7a26 (patch)
treedaaebfd5f6056252febe2e08acad368ae4068b7a
parentedcfcc685d091c58d00f492b26cc339914d76fb6 (diff)
no longer use ia_compat; tested by a few
-rw-r--r--sys/arch/macppc/dev/maci2c.c22
-rw-r--r--sys/dev/i2c/ad741x.c26
-rw-r--r--sys/dev/i2c/adm1021.c7
-rw-r--r--sys/dev/i2c/adm1025.c8
-rw-r--r--sys/dev/i2c/adm1030.c11
-rw-r--r--sys/dev/i2c/adm1031.c11
-rw-r--r--sys/dev/i2c/adt7460.c26
-rw-r--r--sys/dev/i2c/ds1631.c11
-rw-r--r--sys/dev/i2c/fcu.c11
-rw-r--r--sys/dev/i2c/i2c.c3
-rw-r--r--sys/dev/i2c/i2c_scan.c3
-rw-r--r--sys/dev/i2c/i2cvar.h3
-rw-r--r--sys/dev/i2c/lm75.c17
-rw-r--r--sys/dev/i2c/maxim6690.c17
-rw-r--r--sys/dev/i2c/pca9554.c17
-rw-r--r--sys/dev/i2c/tsl2560.c11
16 files changed, 85 insertions, 119 deletions
diff --git a/sys/arch/macppc/dev/maci2c.c b/sys/arch/macppc/dev/maci2c.c
index 554e543b9f8..b3978bd87a8 100644
--- a/sys/arch/macppc/dev/maci2c.c
+++ b/sys/arch/macppc/dev/maci2c.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: maci2c.c,v 1.3 2005/11/16 00:09:31 deraadt Exp $ */
+/* $OpenBSD: maci2c.c,v 1.4 2005/12/27 17:18:18 deraadt Exp $ */
/*
* Copyright (c) 2005 Mark Kettenis
@@ -48,7 +48,7 @@ maciic_attach(struct device *parent, struct device *self, void *aux)
{
struct maci2cbus_attach_args *iba = aux;
struct i2c_attach_args ia;
- char name[32], compat[32];
+ char name[32];
u_int32_t reg;
int node;
@@ -61,16 +61,16 @@ maciic_attach(struct device *parent, struct device *self, void *aux)
ia.ia_tag = iba->iba_tag;
ia.ia_addr = (reg >> 1);
ia.ia_name = NULL;
- ia.ia_compat = NULL;
- memset(compat, 0, sizeof compat);
memset(name, 0, sizeof name);
- if (OF_getprop(node, "name", &name,
- sizeof name))
+ if (OF_getprop(node, "compatible", &name,
+ sizeof name) && name[0])
ia.ia_name = name;
- if (OF_getprop(node, "compatible", &compat,
- sizeof compat))
- ia.ia_compat = compat;
- config_found(self, &ia, maciic_print);
+ if (ia.ia_name == NULL &&
+ OF_getprop(node, "name", &name,
+ sizeof name) && name[0])
+ ia.ia_name = name;
+ if (ia.ia_name)
+ config_found(self, &ia, maciic_print);
}
}
@@ -80,7 +80,7 @@ maciic_print(void *aux, const char *pnp)
struct i2c_attach_args *ia = aux;
if (pnp != NULL) {
- printf("%s at %s", ia->ia_name, pnp);
+ printf("\"%s\" at %s", ia->ia_name, pnp);
}
printf(" addr 0x%x", ia->ia_addr);
diff --git a/sys/dev/i2c/ad741x.c b/sys/dev/i2c/ad741x.c
index 7db99c7e367..1c395999219 100644
--- a/sys/dev/i2c/ad741x.c
+++ b/sys/dev/i2c/ad741x.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ad741x.c,v 1.3 2005/11/28 17:58:20 deraadt Exp $ */
+/* $OpenBSD: ad741x.c,v 1.4 2005/12/27 17:18:18 deraadt Exp $ */
/*
* Copyright (c) 2005 Theo de Raadt
@@ -69,12 +69,10 @@ adc_match(struct device *parent, void *match, void *aux)
{
struct i2c_attach_args *ia = aux;
- if (ia->ia_compat) {
- if (strcmp(ia->ia_compat, "ad7417") == 0)
- return (1);
- return (0);
- }
- return (1);
+ if (strcmp(ia->ia_name, "ad7417") == 0 ||
+ strcmp(ia->ia_name, "ad7418") == 0) /* XXX? */
+ return (1);
+ return (0);
}
void
@@ -88,13 +86,13 @@ adc_attach(struct device *parent, struct device *self, void *aux)
sc->sc_tag = ia->ia_tag;
sc->sc_addr = ia->ia_addr;
- if (ia->ia_compat) {
- sc->sc_chip = 0;
- if (strcmp(ia->ia_compat, "ad7417") == 0)
- sc->sc_chip = 7417;
- if (strcmp(ia->ia_compat, "ad7418") == 0)
- sc->sc_chip = 7418;
- }
+ printf(": %s", ia->ia_name);
+
+ sc->sc_chip = 0;
+ if (strcmp(ia->ia_name, "ad7417") == 0)
+ sc->sc_chip = 7417;
+ if (strcmp(ia->ia_name, "ad7418") == 0)
+ sc->sc_chip = 7418;
if (sc->sc_chip != 0) {
cmd = AD741X_CONFIG2;
diff --git a/sys/dev/i2c/adm1021.c b/sys/dev/i2c/adm1021.c
index b576d9c54bb..dbdc467df71 100644
--- a/sys/dev/i2c/adm1021.c
+++ b/sys/dev/i2c/adm1021.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: adm1021.c,v 1.10 2005/12/26 08:14:17 deraadt Exp $ */
+/* $OpenBSD: adm1021.c,v 1.11 2005/12/27 17:18:18 deraadt Exp $ */
/*
* Copyright (c) 2005 Theo de Raadt
@@ -82,10 +82,11 @@ admtemp_attach(struct device *parent, struct device *self, void *aux)
sc->sc_tag = ia->ia_tag;
sc->sc_addr = ia->ia_addr;
- if (ia->ia_name && strcmp(ia->ia_name, "xeontemp") == 0) {
+ if (strcmp(ia->ia_name, "xeontemp") == 0) {
printf(": Xeon");
sc->sc_xeon = 1;
- }
+ } else
+ printf(": %s", ia->ia_name);
iic_acquire_bus(sc->sc_tag, 0);
cmd = ADM1021_CONFIG_READ;
diff --git a/sys/dev/i2c/adm1025.c b/sys/dev/i2c/adm1025.c
index a47695d9e9f..31cdd0307cc 100644
--- a/sys/dev/i2c/adm1025.c
+++ b/sys/dev/i2c/adm1025.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: adm1025.c,v 1.12 2005/12/24 19:46:33 deraadt Exp $ */
+/* $OpenBSD: adm1025.c,v 1.13 2005/12/27 17:18:18 deraadt Exp $ */
/*
* Copyright (c) 2005 Theo de Raadt
@@ -100,19 +100,21 @@ admtm_attach(struct device *parent, struct device *self, void *aux)
sc->sc_tag = ia->ia_tag;
sc->sc_addr = ia->ia_addr;
+ printf(": %s", ia->ia_name);
+
iic_acquire_bus(sc->sc_tag, 0);
cmd = ADM1025_CONFIG;
if (iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP,
sc->sc_addr, &cmd, sizeof cmd, &data, sizeof data, I2C_F_POLL)) {
iic_release_bus(sc->sc_tag, 0);
- printf(": cannot get control register\n");
+ printf(", cannot get control register\n");
return;
}
data |= 0x01;
if (iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP,
sc->sc_addr, &cmd, sizeof cmd, &data, sizeof data, I2C_F_POLL)) {
iic_release_bus(sc->sc_tag, 0);
- printf(": cannot set control register\n");
+ printf(", cannot set control register\n");
return;
}
iic_release_bus(sc->sc_tag, 0);
diff --git a/sys/dev/i2c/adm1030.c b/sys/dev/i2c/adm1030.c
index c2991a0cf8c..593fbae3c67 100644
--- a/sys/dev/i2c/adm1030.c
+++ b/sys/dev/i2c/adm1030.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: adm1030.c,v 1.2 2005/12/22 22:56:48 deraadt Exp $ */
+/* $OpenBSD: adm1030.c,v 1.3 2005/12/27 17:18:18 deraadt Exp $ */
/*
* Copyright (c) 2005 Theo de Raadt
@@ -62,12 +62,9 @@ admtmp_match(struct device *parent, void *match, void *aux)
{
struct i2c_attach_args *ia = aux;
- if (ia->ia_compat) {
- if (strcmp(ia->ia_compat, "adm1030") == 0)
- return (1);
- return (0);
- }
- return (1);
+ if (strcmp(ia->ia_name, "adm1030") == 0)
+ return (1);
+ return (0);
}
void
diff --git a/sys/dev/i2c/adm1031.c b/sys/dev/i2c/adm1031.c
index 2da66db4770..ba3b46dfc60 100644
--- a/sys/dev/i2c/adm1031.c
+++ b/sys/dev/i2c/adm1031.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: adm1031.c,v 1.1 2005/12/24 19:34:01 deraadt Exp $ */
+/* $OpenBSD: adm1031.c,v 1.2 2005/12/27 17:18:18 deraadt Exp $ */
/*
* Copyright (c) 2005 Theo de Raadt
@@ -67,12 +67,9 @@ admtt_match(struct device *parent, void *match, void *aux)
{
struct i2c_attach_args *ia = aux;
- if (ia->ia_compat) {
- if (strcmp(ia->ia_compat, "adm1031") == 0)
- return (1);
- return (0);
- }
- return (1);
+ if (strcmp(ia->ia_name, "adm1031") == 0)
+ return (1);
+ return (0);
}
void
diff --git a/sys/dev/i2c/adt7460.c b/sys/dev/i2c/adt7460.c
index e5c94c66ad7..57f5f2d6241 100644
--- a/sys/dev/i2c/adt7460.c
+++ b/sys/dev/i2c/adt7460.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: adt7460.c,v 1.3 2005/12/27 09:23:28 deraadt Exp $ */
+/* $OpenBSD: adt7460.c,v 1.4 2005/12/27 17:18:18 deraadt Exp $ */
/*
* Copyright (c) 2005 Mark Kettenis
@@ -79,16 +79,13 @@ adt_match(struct device *parent, void *match, void *aux)
{
struct i2c_attach_args *ia = aux;
- if (ia->ia_compat) {
- if (strcmp(ia->ia_compat, "adt7460") == 0 ||
- strcmp(ia->ia_compat, "adt7467") == 0 ||
- strcmp(ia->ia_compat, "adt7476") == 0 ||
- strcmp(ia->ia_compat, "lm85") == 0 ||
- strcmp(ia->ia_compat, "emc6d10x") == 0)
- return (1);
- return (0);
- }
- return (1); /* accept the address given */
+ if (strcmp(ia->ia_name, "adt7460") == 0 ||
+ strcmp(ia->ia_name, "adt7467") == 0 ||
+ strcmp(ia->ia_name, "adt7476") == 0 ||
+ strcmp(ia->ia_name, "lm85") == 0 ||
+ strcmp(ia->ia_name, "emc6d10x") == 0)
+ return (1);
+ return (0);
}
void
@@ -106,9 +103,8 @@ adt_attach(struct device *parent, struct device *self, void *aux)
sc->sc_chip = 7460;
/* check for the fancy "extension" chips XXX */
- if (ia->ia_compat &&
- (strcmp(ia->ia_compat, "adt7467") == 0 ||
- strcmp(ia->ia_compat, "adt7467") == 0))
+ if (strcmp(ia->ia_name, "adt7467") == 0 ||
+ strcmp(ia->ia_name, "adt7467") == 0)
sc->sc_chip = 7467;
cmd = ADT7460_REVISION;
@@ -132,7 +128,7 @@ adt_attach(struct device *parent, struct device *self, void *aux)
iic_release_bus(sc->sc_tag, 0);
- printf(": ADT%d rev %x", sc->sc_chip, rev);
+ printf(": %s (ADT%d) rev %x", ia->ia_name, sc->sc_chip, rev);
/* Initialize sensor data. */
for (i = 0; i < ADT_NUM_SENSORS; i++)
diff --git a/sys/dev/i2c/ds1631.c b/sys/dev/i2c/ds1631.c
index 9e297db80ec..333e2e50259 100644
--- a/sys/dev/i2c/ds1631.c
+++ b/sys/dev/i2c/ds1631.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ds1631.c,v 1.1 2005/11/16 06:26:14 deraadt Exp $ */
+/* $OpenBSD: ds1631.c,v 1.2 2005/12/27 17:18:18 deraadt Exp $ */
/*
* Copyright (c) 2005 Theo de Raadt
@@ -55,12 +55,9 @@ maxds_match(struct device *parent, void *match, void *aux)
{
struct i2c_attach_args *ia = aux;
- if (ia->ia_compat) {
- if (strcmp(ia->ia_compat, "ds1631") == 0)
- return (1);
- return (0);
- }
- return (1);
+ if (strcmp(ia->ia_name, "ds1631") == 0)
+ return (1);
+ return (0);
}
void
diff --git a/sys/dev/i2c/fcu.c b/sys/dev/i2c/fcu.c
index d38c686d35b..e2a01910d7a 100644
--- a/sys/dev/i2c/fcu.c
+++ b/sys/dev/i2c/fcu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fcu.c,v 1.1 2005/11/16 18:51:45 deraadt Exp $ */
+/* $OpenBSD: fcu.c,v 1.2 2005/12/27 17:18:18 deraadt Exp $ */
/*
* Copyright (c) 2005 Mark Kettenis
@@ -71,12 +71,9 @@ fcu_match(struct device *parent, void *match, void *aux)
{
struct i2c_attach_args *ia = aux;
- if (ia->ia_compat) {
- if (strcmp(ia->ia_compat, "fcu") == 0)
- return (1);
- return (0);
- }
- return (0); /* Apple-only */
+ if (strcmp(ia->ia_name, "fcu") == 0)
+ return (1);
+ return (0);
}
void
diff --git a/sys/dev/i2c/i2c.c b/sys/dev/i2c/i2c.c
index e1cb80668f9..1b4c74cb4cf 100644
--- a/sys/dev/i2c/i2c.c
+++ b/sys/dev/i2c/i2c.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: i2c.c,v 1.9 2005/12/27 09:21:03 deraadt Exp $ */
+/* $OpenBSD: i2c.c,v 1.10 2005/12/27 17:18:18 deraadt Exp $ */
/* $NetBSD: i2c.c,v 1.1 2003/09/30 00:35:31 thorpej Exp $ */
/*
@@ -102,7 +102,6 @@ iic_search(struct device *parent, void *arg, void *aux)
ia.ia_addr = cf->cf_loc[IICCF_ADDR];
ia.ia_size = cf->cf_loc[IICCF_SIZE];
ia.ia_name = "unknown";
- ia.ia_compat = "unknown";
if (cf->cf_attach->ca_match(parent, cf, &ia) > 0)
config_attach(parent, cf, &ia, iic_print);
diff --git a/sys/dev/i2c/i2c_scan.c b/sys/dev/i2c/i2c_scan.c
index 3ce9729bc38..734af40cf28 100644
--- a/sys/dev/i2c/i2c_scan.c
+++ b/sys/dev/i2c/i2c_scan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: i2c_scan.c,v 1.21 2005/12/27 09:23:28 deraadt Exp $ */
+/* $OpenBSD: i2c_scan.c,v 1.22 2005/12/27 17:18:18 deraadt Exp $ */
/*
* Copyright (c) 2005 Alexander Yurchenko <grange@openbsd.org>
@@ -396,7 +396,6 @@ iic_probe(struct device *self, struct i2cbus_attach_args *iba, u_int8_t addr)
ia.ia_addr = addr;
ia.ia_size = 1;
ia.ia_name = name;
- ia.ia_compat = name;
config_found(self, &ia, iic_print);
}
}
diff --git a/sys/dev/i2c/i2cvar.h b/sys/dev/i2c/i2cvar.h
index 9cb01fb5dee..01115a23de6 100644
--- a/sys/dev/i2c/i2cvar.h
+++ b/sys/dev/i2c/i2cvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: i2cvar.h,v 1.5 2005/12/22 23:53:58 deraadt Exp $ */
+/* $OpenBSD: i2cvar.h,v 1.6 2005/12/27 17:18:18 deraadt Exp $ */
/* $NetBSD: i2cvar.h,v 1.1 2003/09/30 00:35:31 thorpej Exp $ */
/*
@@ -103,7 +103,6 @@ struct i2c_attach_args {
i2c_addr_t ia_addr; /* address of device */
int ia_size; /* size (for EEPROMs) */
char *ia_name;
- char *ia_compat;
};
/*
diff --git a/sys/dev/i2c/lm75.c b/sys/dev/i2c/lm75.c
index e833ba12bed..2e06e68a136 100644
--- a/sys/dev/i2c/lm75.c
+++ b/sys/dev/i2c/lm75.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lm75.c,v 1.4 2005/11/15 16:23:31 deraadt Exp $ */
+/* $OpenBSD: lm75.c,v 1.5 2005/12/27 17:18:18 deraadt Exp $ */
/* $NetBSD: lm75.c,v 1.1 2003/09/30 00:35:31 thorpej Exp $ */
/*
* Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org>
@@ -95,17 +95,9 @@ lmtemp_match(struct device *parent, void *match, void *aux)
{
struct i2c_attach_args *ia = aux;
- if (ia->ia_compat) {
- if (strcmp(ia->ia_compat, "lm75") == 0 ||
- strcmp(ia->ia_compat, "ds1775") == 0)
- return (1);
- return (0);
- }
-
- /* XXX: we allow wider mask for LM77 */
- if ((ia->ia_addr & LM75_ADDRMASK) == LM75_ADDR)
+ if (strcmp(ia->ia_name, "lm75") == 0 ||
+ strcmp(ia->ia_name, "ds1775") == 0)
return (1);
-
return (0);
}
@@ -131,7 +123,8 @@ lmtemp_attach(struct device *parent, struct device *self, void *aux)
sc->sc_model = LM_MODEL_LM77;
}
- printf(": %s\n", sc->sc_model == LM_MODEL_LM75 ? "LM75" : "LM77");
+ printf(": %s (%s)\n", ia->ia_name,
+ sc->sc_model == LM_MODEL_LM75 ? "LM75" : "LM77");
iic_release_bus(sc->sc_tag, I2C_F_POLL);
diff --git a/sys/dev/i2c/maxim6690.c b/sys/dev/i2c/maxim6690.c
index 8099c9d4110..16eb181b439 100644
--- a/sys/dev/i2c/maxim6690.c
+++ b/sys/dev/i2c/maxim6690.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: maxim6690.c,v 1.2 2005/11/16 16:27:53 kettenis Exp $ */
+/* $OpenBSD: maxim6690.c,v 1.3 2005/12/27 17:18:18 deraadt Exp $ */
/*
* Copyright (c) 2005 Theo de Raadt
@@ -102,15 +102,12 @@ int
maxtmp_match(struct device *parent, void *match, void *aux)
{
struct i2c_attach_args *ia = aux;
- u_int8_t id, rev;
- if (ia->ia_compat) {
- if (strcmp(ia->ia_compat, "max6642") == 0 ||
- strcmp(ia->ia_compat, "max6690") == 0)
- return (1);
- return (0);
- }
- return (maxtmp_check(ia, &id, &rev));
+ if (strcmp(ia->ia_name, "max6642") == 0 ||
+ strcmp(ia->ia_name, "max6690") == 0)
+ return (1);
+ return (0);
+ // return (maxtmp_check(ia, &id, &rev));
}
void
@@ -129,7 +126,7 @@ maxtmp_attach(struct device *parent, struct device *self, void *aux)
return;
}
- if (ia->ia_compat && strcmp(ia->ia_compat, "max6642") == 0) {
+ if (strcmp(ia->ia_name, "max6642") == 0) {
sc->sc_temp_invalid = MAX6642_TEMP_INVALID;
sc->sc_temp2_mask = MAX6642_TEMP2_MASK;
printf(": MAX6642");
diff --git a/sys/dev/i2c/pca9554.c b/sys/dev/i2c/pca9554.c
index dda9083f5b3..48b336198ff 100644
--- a/sys/dev/i2c/pca9554.c
+++ b/sys/dev/i2c/pca9554.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pca9554.c,v 1.5 2005/12/21 21:53:15 deraadt Exp $ */
+/* $OpenBSD: pca9554.c,v 1.6 2005/12/27 17:18:18 deraadt Exp $ */
/*
* Copyright (c) 2005 Theo de Raadt
@@ -70,15 +70,12 @@ pcagpio_match(struct device *parent, void *match, void *aux)
{
struct i2c_attach_args *ia = aux;
- if (ia->ia_compat) {
- if (strcmp(ia->ia_compat, "PCA9554") == 0 ||
- strcmp(ia->ia_compat, "PCA9554M") == 0 ||
- strcmp(ia->ia_compat, "pca9556") == 0 ||
- strcmp(ia->ia_compat, "pca9557") == 0)
- return (1);
- return (0);
- }
- return (1);
+ if (strcmp(ia->ia_name, "PCA9554") == 0 ||
+ strcmp(ia->ia_name, "PCA9554M") == 0 ||
+ strcmp(ia->ia_name, "pca9556") == 0 ||
+ strcmp(ia->ia_name, "pca9557") == 0)
+ return (1);
+ return (0);
}
void
diff --git a/sys/dev/i2c/tsl2560.c b/sys/dev/i2c/tsl2560.c
index a72cf8bd881..974dfbe30ca 100644
--- a/sys/dev/i2c/tsl2560.c
+++ b/sys/dev/i2c/tsl2560.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tsl2560.c,v 1.1 2005/11/15 22:23:20 kettenis Exp $ */
+/* $OpenBSD: tsl2560.c,v 1.2 2005/12/27 17:18:18 deraadt Exp $ */
/*
* Copyright (c) 2005 Mark Kettenis
@@ -62,12 +62,9 @@ tsl_match(struct device *parent, void *match, void *aux)
{
struct i2c_attach_args *ia = aux;
- if (ia->ia_compat) {
- if (strcmp(ia->ia_compat, "tsl2560") == 0)
- return (1);
- return (0);
- }
- return (1); /* accept the address given */
+ if (strcmp(ia->ia_name, "tsl2560") == 0)
+ return (1);
+ return (0);
}
void