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.

Attachment: signature.asc
Description: PGP signature

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to