Module Name: src
Committed By: thorpej
Date: Mon Dec 23 19:00:59 UTC 2019
Modified Files:
src/sys/dev/i2c: nxt2k.c
Log Message:
- No need to use I2C_F_POLL here.
- If iic_acquire_bus() fails, return the error, not false (because false
looks like "everything A-OK!" to the caller).
To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/i2c/nxt2k.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/nxt2k.c
diff -u src/sys/dev/i2c/nxt2k.c:1.5 src/sys/dev/i2c/nxt2k.c:1.6
--- src/sys/dev/i2c/nxt2k.c:1.5 Thu Jun 1 02:45:10 2017
+++ src/sys/dev/i2c/nxt2k.c Mon Dec 23 19:00:59 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: nxt2k.c,v 1.5 2017/06/01 02:45:10 chs Exp $ */
+/* $NetBSD: nxt2k.c,v 1.6 2019/12/23 19:00:59 thorpej Exp $ */
/*
* Copyright (c) 2008, 2011 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nxt2k.c,v 1.5 2017/06/01 02:45:10 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nxt2k.c,v 1.6 2019/12/23 19:00:59 thorpej Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -74,16 +74,16 @@ nxt2k_writedata(struct nxt2k *nxt, uint8
KASSERT((len + 1) <= 384);
- if (iic_acquire_bus(nxt->tag, I2C_F_POLL) != 0)
- return false;
+ if ((error = iic_acquire_bus(nxt->tag, 0) != 0))
+ return error;
buffer[0] = reg;
memcpy(&buffer[1], data, len);
error = iic_exec(nxt->tag, I2C_OP_WRITE_WITH_STOP, nxt->addr,
- buffer, len + 1, NULL, 0, I2C_F_POLL);
+ buffer, len + 1, NULL, 0, 0);
- iic_release_bus(nxt->tag, I2C_F_POLL);
+ iic_release_bus(nxt->tag, 0);
return error;
}
@@ -93,13 +93,13 @@ nxt2k_readdata(struct nxt2k *nxt, uint8_
{
int error;
- if (iic_acquire_bus(nxt->tag, I2C_F_POLL) != 0)
- return false;
+ if ((error = iic_acquire_bus(nxt->tag, 0) != 0))
+ return error;
error = iic_exec(nxt->tag, I2C_OP_READ_WITH_STOP, nxt->addr,
- ®, 1, data, len, I2C_F_POLL);
+ ®, 1, data, len, 0);
- iic_release_bus(nxt->tag, I2C_F_POLL);
+ iic_release_bus(nxt->tag, 0);
return error;
}