public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] regmap: rbtree: Fix register default look-up in sync
@ 2012-03-23 10:04 Lars-Peter Clausen
  2012-03-24  0:56 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Lars-Peter Clausen @ 2012-03-23 10:04 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-kernel, Lars-Peter Clausen

The code currently passes the register offset in the current block to
regcache_lookup_reg. This works fine as long as there is only one block and with
base register of 0, but in all other cases it will look-up the default for a
wrong register, which can cause unnecessary register writes. This patch fixes
it by passing the actual register number to regcache_lookup_reg.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: <stable@vger.kernel.org>
---
 drivers/base/regmap/regcache-rbtree.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c
index 8d51916..de7241c 100644
--- a/drivers/base/regmap/regcache-rbtree.c
+++ b/drivers/base/regmap/regcache-rbtree.c
@@ -395,7 +395,7 @@ static int regcache_rbtree_sync(struct regmap *map, unsigned int min,
 							   map->cache_word_size);
 
 			/* Is this the hardware default?  If so skip. */
-			ret = regcache_lookup_reg(map, i);
+			ret = regcache_lookup_reg(map, regtmp);
 			if (ret >= 0 && val == map->reg_defaults[ret].def)
 				continue;
 
-- 
1.7.9.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] regmap: rbtree: Fix register default look-up in sync
  2012-03-23 10:04 [PATCH] regmap: rbtree: Fix register default look-up in sync Lars-Peter Clausen
@ 2012-03-24  0:56 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2012-03-24  0:56 UTC (permalink / raw)
  To: Lars-Peter Clausen; +Cc: linux-kernel, dp

[-- Attachment #1: Type: text/plain, Size: 706 bytes --]

On Fri, Mar 23, 2012 at 11:04:57AM +0100, Lars-Peter Clausen wrote:
> The code currently passes the register offset in the current block to
> regcache_lookup_reg. This works fine as long as there is only one block and with
> base register of 0, but in all other cases it will look-up the default for a
> wrong register, which can cause unnecessary register writes. This patch fixes
> it by passing the actual register number to regcache_lookup_reg.
> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> Cc: <stable@vger.kernel.org>

Good catch - I'm fairly surprised nobody (including me) noticed it over
the couple of kernel releases it's been there.  Will apply once we've
got an -rc1.

[-- 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:[~2012-03-24  0:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-23 10:04 [PATCH] regmap: rbtree: Fix register default look-up in sync Lars-Peter Clausen
2012-03-24  0:56 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox