summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2005-12-27 03:54:28 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2005-12-27 03:54:28 +0000
commit94830c6ae46203635a90d34433360c8d341cb943 (patch)
tree256a89622f1dccef5b54ab144d7e9eb4e35473db
parent52808f417623dab451dcf9b34fcc0d052a61e387 (diff)
if we write to the START bit, splat out a message
-rw-r--r--sys/dev/i2c/lm87.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/sys/dev/i2c/lm87.c b/sys/dev/i2c/lm87.c
index da429f527ec..544d70309e1 100644
--- a/sys/dev/i2c/lm87.c
+++ b/sys/dev/i2c/lm87.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lm87.c,v 1.8 2005/12/26 03:52:53 deraadt Exp $ */
+/* $OpenBSD: lm87.c,v 1.9 2005/12/27 03:54:27 deraadt Exp $ */
/*
* Copyright (c) 2005 Mark Kettenis
@@ -104,11 +104,20 @@ lmenv_attach(struct device *parent, struct device *self, void *aux)
iic_acquire_bus(sc->sc_tag, 0);
+ cmd = LM87_REVISION;
+ if (iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP,
+ sc->sc_addr, &cmd, sizeof cmd, &data, sizeof data, 0)) {
+ iic_release_bus(sc->sc_tag, 0);
+ printf(": cannot read ID register\n");
+ return;
+ }
+ printf(": LM87 rev %x", data);
+
cmd = LM87_FANDIV;
if (iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP,
sc->sc_addr, &cmd, sizeof cmd, &data, sizeof data, 0)) {
iic_release_bus(sc->sc_tag, 0);
- printf(": cannot read Fan Divisor register\n");
+ printf(", cannot read Fan Divisor register\n");
return;
}
sc->sc_fan1_div = 1 << ((data >> 4) & 0x03);
@@ -118,7 +127,7 @@ lmenv_attach(struct device *parent, struct device *self, void *aux)
if (iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP,
sc->sc_addr, &cmd, sizeof cmd, &channel, sizeof channel, 0)) {
iic_release_bus(sc->sc_tag, 0);
- printf(": cannot read Channel register\n");
+ printf(", cannot read Channel register\n");
return;
}
@@ -126,7 +135,7 @@ lmenv_attach(struct device *parent, struct device *self, void *aux)
if (iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP,
sc->sc_addr, &cmd, sizeof cmd, &data, sizeof data, 0)) {
iic_release_bus(sc->sc_tag, 0);
- printf(": cannot read Configuration Register 1\n");
+ printf(", cannot read Configuration Register 1\n");
return;
}
@@ -135,23 +144,15 @@ lmenv_attach(struct device *parent, struct device *self, void *aux)
if (iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP,
sc->sc_addr, &cmd, sizeof cmd, &data, sizeof data, 0)) {
iic_release_bus(sc->sc_tag, 0);
- printf(": cannot write Configuration Register 1\n");
+ printf(", cannot write Configuration Register 1\n");
return;
}
+ printf(", starting scan");
}
- cmd = LM87_REVISION;
- if (iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP,
- sc->sc_addr, &cmd, sizeof cmd, &data, sizeof data, 0)) {
- iic_release_bus(sc->sc_tag, 0);
- printf(": cannot read ID register\n");
- return;
- }
iic_release_bus(sc->sc_tag, 0);
- printf(": LM87 rev %x", data);
-
/* Initialize sensor data. */
for (i = 0; i < LMENV_NUM_SENSORS; i++)
strlcpy(sc->sc_sensor[i].device, sc->sc_dev.dv_xname,