summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2024-05-31 16:09:27 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2024-05-31 16:09:27 -0700
commitb7c05622da0e40c0ce93f847055a57e47df35492 (patch)
treedf48e7f22fd8214d48cfc8f069a2a1c59a471bed
parent0f9a75179da33cc03594b882ed823cc5f4356d9a (diff)
parent611b7eb19d0a305d4de00280e4a71a1b15c507fc (diff)
downloadlwn-b7c05622da0e40c0ce93f847055a57e47df35492.tar.gz
lwn-b7c05622da0e40c0ce93f847055a57e47df35492.zip
Merge tag 'regmap-fix-v6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap
Pull regmap fix from Mark Brown: "The I2C bus was not taking account of the register and any padding bytes when handling maximum write sizes supported by an I2C adaptor, this patch from Jim Wylder fixes that" * tag 'regmap-fix-v6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap: regmap-i2c: Subtract reg size from max_write
-rw-r--r--drivers/base/regmap/regmap-i2c.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/base/regmap/regmap-i2c.c b/drivers/base/regmap/regmap-i2c.c
index 3ec611dc0c09..a905e955bbfc 100644
--- a/drivers/base/regmap/regmap-i2c.c
+++ b/drivers/base/regmap/regmap-i2c.c
@@ -350,7 +350,8 @@ static const struct regmap_bus *regmap_get_i2c_bus(struct i2c_client *i2c,
if (quirks->max_write_len &&
(bus->max_raw_write == 0 || bus->max_raw_write > quirks->max_write_len))
- max_write = quirks->max_write_len;
+ max_write = quirks->max_write_len -
+ (config->reg_bits + config->pad_bits) / BITS_PER_BYTE;
if (max_read || max_write) {
ret_bus = kmemdup(bus, sizeof(*bus), GFP_KERNEL);