This is a note to let you know that I've just added the patch titled regmap: Account for register length in SMBus I/O limits to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: regmap-account-for-register-length-in-smbus-i-o-limits.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 0c9d2eb5e94792fe64019008a04d4df5e57625af Mon Sep 17 00:00:00 2001 From: Mark Brown <broonie@xxxxxxxxxx> Date: Wed, 12 Jul 2023 12:16:40 +0100 Subject: regmap: Account for register length in SMBus I/O limits From: Mark Brown <broonie@xxxxxxxxxx> commit 0c9d2eb5e94792fe64019008a04d4df5e57625af 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@xxxxxxxxxx Signed-off-by: Mark Brown <broonie@xxxxxxxxxx> Reviewed-by: Xu Yilun <yilun.xu@xxxxxxxxx> Link: https://lore.kernel.org/r/20230712-regmap-max-transfer-v1-2-80e2aed22e83@xxxxxxxxxx Signed-off-by: Mark Brown <broonie@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/base/regmap/regmap-i2c.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/base/regmap/regmap-i2c.c +++ b/drivers/base/regmap/regmap-i2c.c @@ -242,8 +242,8 @@ static int regmap_i2c_smbus_i2c_read(voi 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_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, Patches currently in stable-queue which might be from broonie@xxxxxxxxxx are queue-5.10/asoc-es8316-do-not-set-rate-constraints-for-unsuppor.patch queue-5.10/asoc-fsl_sai-disable-bit-clock-with-transmitter.patch queue-5.10/spi-bcm-qspi-return-error-if-neither-hif_mspi-nor-ms.patch queue-5.10/asoc-es8316-increment-max-value-for-alc-capture-targ.patch queue-5.10/asoc-imx-audmix-check-return-value-of-devm_kasprintf.patch queue-5.10/media-cec-i2c-ch7322-also-select-regmap.patch queue-5.10/spi-spi-geni-qcom-correct-cs_toggle-bit-in-spi_trans.patch queue-5.10/regulator-core-streamline-debugfs-operations.patch queue-5.10/asoc-mediatek-mt8173-fix-irq-error-path.patch queue-5.10/regmap-drop-initial-version-of-maximum-transfer-length-fixes.patch queue-5.10/regulator-core-fix-more-error-checking-for-debugfs_c.patch queue-5.10/asoc-mediatek-mt8173-fix-snd_soc_component_initialize-error-path.patch queue-5.10/regmap-account-for-register-length-in-smbus-i-o-limits.patch