[RFC 6/9] regmap: Speed up _regmap_raw_write_impl() for large buffers
Mark Brown
broonie at kernel.org
Mon Feb 17 12:15:12 UTC 2020
On Sun, Feb 16, 2020 at 06:21:14PM +0100, Noralf Trønnes wrote:
> 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.
This is a generic optimization, why is it mixed in with the rest of this
series? There is no dependency either way :(
> /* 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;
> + }
This is going to break if there is any change to the implementation of
regmap_writeable(). The code should at least be next to that if not
actually shared so that this doesn't happen. I'd suggest implementing a
function regmap_writeable_range() and then making regmap_writeable()
call that.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20200217/0a38e705/attachment-0001.sig>
More information about the dri-devel
mailing list