mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
regmap: cache Fix regcache-rbtree sync
commit8abac3ba51upstream. The last register block, which falls into the specified range, is not handled correctly. The formula which calculates the number of register which should be synced is inverse (and off by one). E.g. if all registers in that block should be synced only one is synced, and if only one should be synced all (but one) are synced. To calculate the number of registers that need to be synced we need to subtract the number of the first register in the block from the max register number and add one. This patch updates the code accordingly. The issue was introduced in commitac8d91c("regmap: Supply ranges to the sync operations"). Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
5d05e0b850
commit
bbe2d01529
@@ -398,7 +398,7 @@ static int regcache_rbtree_sync(struct regmap *map, unsigned int min,
|
||||
base = 0;
|
||||
|
||||
if (max < rbnode->base_reg + rbnode->blklen)
|
||||
end = rbnode->base_reg + rbnode->blklen - max;
|
||||
end = max - rbnode->base_reg + 1;
|
||||
else
|
||||
end = rbnode->blklen;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user