regmap: Fix for v6.10

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.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmZaAOYACgkQJNaLcl1U
 h9DNPQf+Ntxc4wrrMiZwfASW0ar6ckmclxKZP95NWYxd6XHZJ/E6uMRlHdAJh1Np
 LooEHMy+Sg0n6w7FGfVgL22rhpZA8SBeZTrdD3s3YIFoXotfuuOdqcV6WNlj/ZE3
 pc5N2M1WhLo1rnTURSWnGtYW6aqoJ69SfZstuWvw/PJkDxnmwB4+abHAF5Of2q36
 koRuYnaFOzvvEGi1vDqTgBSWoYHmsxORkuHBA59k1JxWlj3oZGDyRy7nyYPxjYes
 D87WnVMSE17qw+rStjd1GktgMYxd82I+5mIFaXCQKppm6caXqkrZCkLLeySAumFA
 32R3y5goI3MntEefkXuwW5Lv0r+qNQ==
 =mHu+
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2024-05-31 16:09:27 -07:00
commit b7c05622da

View File

@ -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);