]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
regmap-i2c: Subtract reg size from max_write
authorJim Wylder <jwylder@google.com>
Thu, 23 May 2024 21:14:36 +0000 (16:14 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 Jul 2024 10:51:22 +0000 (12:51 +0200)
commit010c0de852c61c9b105d59de2e70daeb4fb8ee41
tree9b06b8ae660dd2d42a922aa50ba7da4f640b9bb3
parentfd04704e3c8071d8db83e03ba07b405993350241
regmap-i2c: Subtract reg size from max_write

[ Upstream commit 611b7eb19d0a305d4de00280e4a71a1b15c507fc ]

Currently, when an adapter defines a max_write_len quirk,
the data will be chunked into data sizes equal to the
max_write_len quirk value.  But the payload will be increased by
the size of the register address before transmission.  The
resulting value always ends up larger than the limit set
by the quirk.

Avoid this error by setting regmap's max_write to the quirk's
max_write_len minus the number of bytes for the register and
padding.  This allows the chunking to work correctly for this
limited case without impacting other use-cases.

Signed-off-by: Jim Wylder <jwylder@google.com>
Link: https://msgid.link/r/20240523211437.2839942-1-jwylder@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/base/regmap/regmap-i2c.c