Skip to content

Commit bc64734

Browse files
committed
regmap: Drop initial version of maximum transfer length fixes
When problems were noticed with the register address not being taken into account when limiting raw transfers with I2C devices we fixed this in the core. Unfortunately it has subsequently been realised that a lot of buses were relying on the prior behaviour, partly due to unclear documentation not making it obvious what was intended in the core. This is all more involved to fix than is sensible for a fix commit so let's just drop the original fixes, a separate commit will fix the originally observed problem in an I2C specific way Fixes: 3981514 ("regmap: Account for register length when chunking") Fixes: c8e7968 ("regmap: spi-avmm: Fix regmap_bus max_raw_write") Signed-off-by: Mark Brown <broonie@kernel.org> Reviewed-by: Xu Yilun <yilun.xu@intel.com> Cc: stable@kernel.org Link: https://lore.kernel.org/r/20230712-regmap-max-transfer-v1-1-80e2aed22e83@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent fdf0eaf commit bc64734

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

drivers/base/regmap/regmap-spi-avmm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ static const struct regmap_bus regmap_spi_avmm_bus = {
660660
.reg_format_endian_default = REGMAP_ENDIAN_NATIVE,
661661
.val_format_endian_default = REGMAP_ENDIAN_NATIVE,
662662
.max_raw_read = SPI_AVMM_VAL_SIZE * MAX_READ_CNT,
663-
.max_raw_write = SPI_AVMM_REG_SIZE + SPI_AVMM_VAL_SIZE * MAX_WRITE_CNT,
663+
.max_raw_write = SPI_AVMM_VAL_SIZE * MAX_WRITE_CNT,
664664
.free_context = spi_avmm_bridge_ctx_free,
665665
};
666666

drivers/base/regmap/regmap.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2082,17 +2082,15 @@ int _regmap_raw_write(struct regmap *map, unsigned int reg,
20822082
size_t val_count = val_len / val_bytes;
20832083
size_t chunk_count, chunk_bytes;
20842084
size_t chunk_regs = val_count;
2085-
size_t max_data = map->max_raw_write - map->format.reg_bytes -
2086-
map->format.pad_bytes;
20872085
int ret, i;
20882086

20892087
if (!val_count)
20902088
return -EINVAL;
20912089

20922090
if (map->use_single_write)
20932091
chunk_regs = 1;
2094-
else if (map->max_raw_write && val_len > max_data)
2095-
chunk_regs = max_data / val_bytes;
2092+
else if (map->max_raw_write && val_len > map->max_raw_write)
2093+
chunk_regs = map->max_raw_write / val_bytes;
20962094

20972095
chunk_count = val_count / chunk_regs;
20982096
chunk_bytes = chunk_regs * val_bytes;

0 commit comments

Comments
 (0)