* [PATCH] regmap: Fix regcache-rbtree sync
@ 2013-03-13 15:38 Lars-Peter Clausen
2013-03-13 19:08 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Lars-Peter Clausen @ 2013-03-13 15:38 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-kernel, Lars-Peter Clausen, stable
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 commit ac8d91c ("regmap: Supply ranges to the sync
operations").
Cc: stable@vger.kernel.org
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
drivers/base/regmap/regcache-rbtree.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c
index 0453196..a1f67eb 100644
--- a/drivers/base/regmap/regcache-rbtree.c
+++ b/drivers/base/regmap/regcache-rbtree.c
@@ -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;
--
1.8.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] regmap: Fix regcache-rbtree sync
2013-03-13 15:38 [PATCH] regmap: Fix regcache-rbtree sync Lars-Peter Clausen
@ 2013-03-13 19:08 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2013-03-13 19:08 UTC (permalink / raw)
To: Lars-Peter Clausen; +Cc: linux-kernel, stable
[-- Attachment #1: Type: text/plain, Size: 247 bytes --]
On Wed, Mar 13, 2013 at 04:38:33PM +0100, Lars-Peter Clausen wrote:
> 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
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-03-13 19:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-13 15:38 [PATCH] regmap: Fix regcache-rbtree sync Lars-Peter Clausen
2013-03-13 19:08 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).