mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
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 <[email protected]> Tested-by: Michel Daenzer <[email protected]> Acked-by: Benjamin Herrenschmidt <[email protected]> Cc: Paul Mackerras <[email protected]>
This commit is contained in:
parent
dddc66ffa0
commit
6f7e549f87
1 changed files with 6 additions and 0 deletions
|
|
@ -146,6 +146,12 @@ static int i2c_powermac_master_xfer( struct i2c_adapter *adap,
|
|||
int read;
|
||||
int addrdir;
|
||||
|
||||
if (num != 1) {
|
||||
dev_err(&adap->dev,
|
||||
"Multi-message I2C transactions not supported\n");
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
if (msgs->flags & I2C_M_TEN)
|
||||
return -EINVAL;
|
||||
read = (msgs->flags & I2C_M_RD) != 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue