Module Name: src
Committed By: thorpej
Date: Mon Dec 23 14:48:58 UTC 2019
Modified Files:
src/sys/dev/i2c: mcp980x.c
Log Message:
No need to use I2C_F_POLL here.
To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/i2c/mcp980x.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/i2c/mcp980x.c
diff -u src/sys/dev/i2c/mcp980x.c:1.6 src/sys/dev/i2c/mcp980x.c:1.7
--- src/sys/dev/i2c/mcp980x.c:1.6 Sat Jun 16 21:22:13 2018
+++ src/sys/dev/i2c/mcp980x.c Mon Dec 23 14:48:58 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: mcp980x.c,v 1.6 2018/06/16 21:22:13 thorpej Exp $ */
+/* $NetBSD: mcp980x.c,v 1.7 2019/12/23 14:48:58 thorpej Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mcp980x.c,v 1.6 2018/06/16 21:22:13 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mcp980x.c,v 1.7 2019/12/23 14:48:58 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -143,18 +143,18 @@ mcp980x_reg_read_2(struct mcp980x_softc
{
uint16_t rv;
- if (iic_acquire_bus(sc->sc_tag, I2C_F_POLL) != 0) {
+ if (iic_acquire_bus(sc->sc_tag, 0) != 0) {
aprint_error_dev(sc->sc_dev, "cannot acquire bus for read\n");
return 0;
}
if (iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, sc->sc_addr, ®,
- 1, &rv, 2, I2C_F_POLL)) {
+ 1, &rv, 2, 0)) {
+ iic_release_bus(sc->sc_tag, 0);
aprint_error_dev(sc->sc_dev, "cannot execute operation\n");
- iic_release_bus(sc->sc_tag, I2C_F_POLL);
return 0;
}
- iic_release_bus(sc->sc_tag, I2C_F_POLL);
+ iic_release_bus(sc->sc_tag, 0);
return be16toh(rv);
}
@@ -164,18 +164,18 @@ mcp980x_reg_read_1(struct mcp980x_softc
{
uint8_t rv;
- if (iic_acquire_bus(sc->sc_tag, I2C_F_POLL) != 0) {
+ if (iic_acquire_bus(sc->sc_tag, 0) != 0) {
aprint_error_dev(sc->sc_dev, "cannot acquire bus for read\n");
return 0;
}
if (iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, sc->sc_addr, ®,
- 1, &rv, 1, I2C_F_POLL)) {
+ 1, &rv, 1, 0)) {
+ iic_release_bus(sc->sc_tag, 0);
aprint_error_dev(sc->sc_dev, "cannot execute operation\n");
- iic_release_bus(sc->sc_tag, I2C_F_POLL);
return 0;
}
- iic_release_bus(sc->sc_tag, I2C_F_POLL);
+ iic_release_bus(sc->sc_tag, 0);
return rv;
}
@@ -187,34 +187,34 @@ mcp980x_reg_write_2(struct mcp980x_softc
beval = htobe16(val);
- if (iic_acquire_bus(sc->sc_tag, I2C_F_POLL) != 0) {
+ if (iic_acquire_bus(sc->sc_tag, 0) != 0) {
aprint_error_dev(sc->sc_dev, "cannot acquire bus for write\n");
return;
}
if (iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP, sc->sc_addr, ®,
- 1, &beval, 2, I2C_F_POLL)) {
+ 1, &beval, 2, 0)) {
aprint_error_dev(sc->sc_dev, "cannot execute operation\n");
}
- iic_release_bus(sc->sc_tag, I2C_F_POLL);
+ iic_release_bus(sc->sc_tag, 0);
}
static void
mcp980x_reg_write_1(struct mcp980x_softc *sc, uint8_t reg, uint8_t val)
{
- if (iic_acquire_bus(sc->sc_tag, I2C_F_POLL) != 0) {
+ if (iic_acquire_bus(sc->sc_tag, 0) != 0) {
aprint_error_dev(sc->sc_dev, "cannot acquire bus for write\n");
return;
}
if (iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP, sc->sc_addr, ®,
- 1, &val, 1, I2C_F_POLL)) {
+ 1, &val, 1, 0)) {
aprint_error_dev(sc->sc_dev, "cannot execute operation\n");
}
- iic_release_bus(sc->sc_tag, I2C_F_POLL);
+ iic_release_bus(sc->sc_tag, 0);
}