When writing a 3MB buffer the unwritable check in _regmap_raw_write_impl() adds a ~20ms overhead on a Raspberry Pi 4. Amend this by avoiding the check if it's not necessary. Signed-off-by: Noralf Trønnes <noralf@xxxxxxxxxxx> --- drivers/base/regmap/regmap.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 19f57ccfbe1d..cd876309a74b 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -1489,10 +1489,12 @@ static int _regmap_raw_write_impl(struct regmap *map, unsigned int reg, WARN_ON(!map->bus); /* Check for unwritable registers before we start */ - for (i = 0; i < val_len / map->format.val_bytes; i++) - if (!regmap_writeable(map, - reg + regmap_get_offset(map, i))) - return -EINVAL; + if (map->max_register || map->writeable_reg || map->wr_table) { + for (i = 0; i < val_len / map->format.val_bytes; i++) + if (!regmap_writeable(map, + reg + regmap_get_offset(map, i))) + return -EINVAL; + } if (!map->cache_bypass && map->format.parse_val) { unsigned int ival; -- 2.23.0 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel