lkml.org 
[lkml]   [2019]   [Aug]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] regmap: fix writes to non incrementing registers
On Tue, Aug 13, 2019 at 10:22:51PM +0100, Ben Whitten wrote:

> @@ -1489,10 +1489,11 @@ 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 (!regmap_writeable_noinc(map, reg))
> + for (i = 0; i < val_len / map->format.val_bytes; i++)
> + if (!regmap_writeable(map,
> + reg + regmap_get_offset(map, i)))
> + return -EINVAL;

This feels like we're getting ourselves confused about nonincrementing
registers and probably have other breakage somewhere else - we're
already checking for nonincrementability in regmap_write_noinc(), and
here we're only checking if the first register in the block has that
property which might blow up on us if there's a register in the middle
of the block that is nonincrementable. If we're going to check this
here I think we should check on every register, but this is
_raw_write_impl() which is part of the call path for implementing
regmap_noinc_write() so checking here will break the API purpose
designed for nonincrementing writes.
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2019-08-14 12:02    [W:0.040 / U:1.320 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site