mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
i2c: quirks: add zero length checks
Some adapters do not support a message length of 0. Add this as a quirk so drivers don't have to open code it. Signed-off-by: Wolfram Sang <[email protected]> Reviewed-by: Niklas Söderlund <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Tested-by: Jarkko Nikula <[email protected]> Acked-by: Jarkko Nikula <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
This commit is contained in:
parent
5799c4b2f1
commit
d9cfe2ce24
2 changed files with 10 additions and 0 deletions
|
|
@ -1839,9 +1839,15 @@ static int i2c_check_for_quirks(struct i2c_adapter *adap, struct i2c_msg *msgs,
|
|||
if (msgs[i].flags & I2C_M_RD) {
|
||||
if (do_len_check && i2c_quirk_exceeded(len, q->max_read_len))
|
||||
return i2c_quirk_error(adap, &msgs[i], "msg too long");
|
||||
|
||||
if (q->flags & I2C_AQ_NO_ZERO_LEN_READ && len == 0)
|
||||
return i2c_quirk_error(adap, &msgs[i], "no zero length");
|
||||
} else {
|
||||
if (do_len_check && i2c_quirk_exceeded(len, q->max_write_len))
|
||||
return i2c_quirk_error(adap, &msgs[i], "msg too long");
|
||||
|
||||
if (q->flags & I2C_AQ_NO_ZERO_LEN_WRITE && len == 0)
|
||||
return i2c_quirk_error(adap, &msgs[i], "no zero length");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue