aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2009-12-06 11:06:17 -0500
committerJean Delvare <khali@linux-fr.org>2009-12-06 11:06:17 -0500
commit6f7e549f873e9ff10a4a27241db568bf7988ee0c (patch)
tree7b8d37442fe3b6ebbaedda63deb65276a2371c9b /drivers/i2c
parentdddc66ffa048fbc842f5de385031f1826649ffc2 (diff)
i2c-powermac: Reject unsupported I2C transactions
The i2c-powermac driver doesn't support arbitrary multi-message I2C transactions, only SMBus ones. Make it clear by returning an error if a multi-message I2C transaction is attempted. This is better than only processing the first message, because most callers won't recover from the short transaction. Anyone wishing to issue multi-message transactions should use the SMBus API instead of the raw I2C API. Signed-off-by: Jean Delvare <khali@linux-fr.org> Tested-by: Michel Daenzer <michel@daenzer.net> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-powermac.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c
index 3c9d71f60187..a74f3bab05b8 100644
--- a/drivers/i2c/busses/i2c-powermac.c
+++ b/drivers/i2c/busses/i2c-powermac.c
@@ -146,6 +146,12 @@ static int i2c_powermac_master_xfer( struct i2c_adapter *adap,
146 int read; 146 int read;
147 int addrdir; 147 int addrdir;
148 148
149 if (num != 1) {
150 dev_err(&adap->dev,
151 "Multi-message I2C transactions not supported\n");
152 return -EOPNOTSUPP;
153 }
154
149 if (msgs->flags & I2C_M_TEN) 155 if (msgs->flags & I2C_M_TEN)
150 return -EINVAL; 156 return -EINVAL;
151 read = (msgs->flags & I2C_M_RD) != 0; 157 read = (msgs->flags & I2C_M_RD) != 0;