All of lore.kernel.org
 help / color / mirror / Atom feed
* regcache_sync() errors for read-only registers cache
@ 2015-02-27 12:59 Takashi Iwai
  2015-03-02 18:24 ` Mark Brown
  0 siblings, 1 reply; 9+ messages in thread
From: Takashi Iwai @ 2015-02-27 12:59 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-kernel

Hi Mark,

the current regcache_sync() has a problem when there are read-only
registers that are cached in regmap: it tries to write all cached
registers no matter whether it's writable or not, resulting in
kernel errors like "Unable to sync register 0x1234. -5".

A quick fix is the patch like below, but obviously it doesn't cover
the all cases but only addresses the signle rw.

Also, _regmap_write() itself calls again regmap_writeable(), so it's
superfluous.  Alternatively, we may check -EIO from _regmap_write()
and treat as a special case not to show the error.  Or, add a
parameter to skip regmap_writeable() call.


Takashi

-- 8< --
From: Takashi Iwai <tiwai@suse.de>
Subject: [PATCH] regmap: Skip read-only registers in regcache_sync_block_single()

regcache_sync() spews warnings when a value was cached for a read-only
register as it tries to write all registers no matter whether they are
writable or not.  This patch fixes (a part of) the problem by adding
regmap_writeable() check in regcache_sync_block_single().

Note that the patch covers only the code path using single rw.  When a
raw block write is used, the problem may still exist.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---

 drivers/base/regmap/regcache.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index f373c35f9e1d..30534864735c 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -617,6 +617,8 @@ static int regcache_sync_block_single(struct regmap *map, void *block,
 		ret = regcache_lookup_reg(map, regtmp);
 		if (ret >= 0 && val == map->reg_defaults[ret].def)
 			continue;
+		if (!regmap_writeable(map, regtmp))
+			continue;
 
 		map->cache_bypass = 1;
 
-- 
2.3.0


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

end of thread, other threads:[~2015-03-03 22:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-27 12:59 regcache_sync() errors for read-only registers cache Takashi Iwai
2015-03-02 18:24 ` Mark Brown
2015-03-02 19:15   ` Takashi Iwai
2015-03-03  9:09     ` Mark Brown
2015-03-03  9:22       ` Takashi Iwai
2015-03-03 14:54         ` Mark Brown
2015-03-03 15:33           ` Takashi Iwai
2015-03-03 20:04             ` Mark Brown
2015-03-03 22:00               ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.