[i2c] [PATCH 05/13] i2c-powermac: Fix master_xfer return value
Jean Delvare
khali at linux-fr.org
Sat Jul 1 17:12:53 CEST 2006
Content-Disposition: inline; filename=i2c-powermac-fix-master-xfer-return.patch
Fix the value returned by the i2c-powermac's master_xfer method.
It should return the number of messages processed successfully, but
instead returns the number of data bytes in the first (and only)
processed message.
Also explicitly mention the master_xfer convention so that future
implementations get it right directly.
Signed-off-by: Jean Delvare <khali at linux-fr.org>
Acked-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
---
drivers/i2c/busses/i2c-powermac.c | 4 +---
include/linux/i2c.h | 2 ++
2 files changed, 3 insertions(+), 3 deletions(-)
--- linux-2.6.17-git.orig/drivers/i2c/busses/i2c-powermac.c 2006-07-01 15:16:13.000000000 +0200
+++ linux-2.6.17-git/drivers/i2c/busses/i2c-powermac.c 2006-07-01 15:20:06.000000000 +0200
@@ -148,8 +148,6 @@
int read;
int addrdir;
- if (num != 1)
- return -EINVAL;
if (msgs->flags & I2C_M_TEN)
return -EINVAL;
read = (msgs->flags & I2C_M_RD) != 0;
@@ -166,7 +164,7 @@
rc = pmac_i2c_xfer(bus, addrdir, 0, 0, msgs->buf, msgs->len);
bail:
pmac_i2c_close(bus);
- return rc < 0 ? rc : msgs->len;
+ return rc < 0 ? rc : 1;
}
static u32 i2c_powermac_func(struct i2c_adapter * adapter)
--- linux-2.6.17-git.orig/include/linux/i2c.h 2006-07-01 15:17:19.000000000 +0200
+++ linux-2.6.17-git/include/linux/i2c.h 2006-07-01 15:20:06.000000000 +0200
@@ -193,6 +193,8 @@
to NULL. If an adapter algorithm can do SMBus access, set
smbus_xfer. If set to NULL, the SMBus protocol is simulated
using common I2C messages */
+ /* master_xfer should return the number of messages successfully
+ processed, or a negative value on error */
int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg *msgs,
int num);
int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr,
--
Jean Delvare
More information about the i2c
mailing list