From: Takashi Iwai <tiwai@suse.de>
To: Mark Brown <broonie@kernel.org>
Cc: linux-kernel@vger.kernel.org
Subject: regcache_sync() errors for read-only registers cache
Date: Fri, 27 Feb 2015 13:59:30 +0100 [thread overview]
Message-ID: <s5h385ry0gd.wl-tiwai@suse.de> (raw)
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
next reply other threads:[~2015-02-27 12:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-27 12:59 Takashi Iwai [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=s5h385ry0gd.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®