mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-03 07:38:10 +00:00
regmap: Account for register length in SMBus I/O limits
commit 0c9d2eb5e9
upstream.
The SMBus I2C buses have limits on the size of transfers they can do but
do not factor in the register length meaning we may try to do a transfer
longer than our length limit, the core will not take care of this.
Future changes will factor this out into the core but there are a number
of users that assume current behaviour so let's just do something
conservative here.
This does not take account padding bits but practically speaking these
are very rarely if ever used on I2C buses given that they generally run
slowly enough to mean there's no issue.
Cc: stable@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Xu Yilun <yilun.xu@intel.com>
Link: https://lore.kernel.org/r/20230712-regmap-max-transfer-v1-2-80e2aed22e83@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
8b3dd8d23f
commit
3e412b6e2b
1 changed files with 4 additions and 4 deletions
|
@ -242,8 +242,8 @@ static int regmap_i2c_smbus_i2c_read(void *context, const void *reg,
|
|||
static const struct regmap_bus regmap_i2c_smbus_i2c_block = {
|
||||
.write = regmap_i2c_smbus_i2c_write,
|
||||
.read = regmap_i2c_smbus_i2c_read,
|
||||
.max_raw_read = I2C_SMBUS_BLOCK_MAX,
|
||||
.max_raw_write = I2C_SMBUS_BLOCK_MAX,
|
||||
.max_raw_read = I2C_SMBUS_BLOCK_MAX - 1,
|
||||
.max_raw_write = I2C_SMBUS_BLOCK_MAX - 1,
|
||||
};
|
||||
|
||||
static int regmap_i2c_smbus_i2c_write_reg16(void *context, const void *data,
|
||||
|
@ -299,8 +299,8 @@ static int regmap_i2c_smbus_i2c_read_reg16(void *context, const void *reg,
|
|||
static const struct regmap_bus regmap_i2c_smbus_i2c_block_reg16 = {
|
||||
.write = regmap_i2c_smbus_i2c_write_reg16,
|
||||
.read = regmap_i2c_smbus_i2c_read_reg16,
|
||||
.max_raw_read = I2C_SMBUS_BLOCK_MAX,
|
||||
.max_raw_write = I2C_SMBUS_BLOCK_MAX,
|
||||
.max_raw_read = I2C_SMBUS_BLOCK_MAX - 2,
|
||||
.max_raw_write = I2C_SMBUS_BLOCK_MAX - 2,
|
||||
};
|
||||
|
||||
static const struct regmap_bus *regmap_get_i2c_bus(struct i2c_client *i2c,
|
||||
|
|
Loading…
Reference in a new issue