[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <s5h385ry0gd.wl-tiwai@suse.de>
Date: Fri, 27 Feb 2015 13:59:30 +0100
From: Takashi Iwai <tiwai@...e.de>
To: Mark Brown <broonie@...nel.org>
Cc: linux-kernel@...r.kernel.org
Subject: regcache_sync() errors for read-only registers cache
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@...e.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@...e.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists