All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] regmap: Skip read-only registers in regcache_sync()
@ 2015-03-04 14:29 Takashi Iwai
  2015-03-04 17:09 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Takashi Iwai @ 2015-03-04 14:29 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-kernel

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 adds regmap_wrtieable() checks for
avoiding it in regcache_sync_block_single() and regcache_block_raw().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
v1->v2: call regmap_writeable() at the place regcache_reg_preset() is called
        also fix regcache_sync_block_raw()

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

diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index f373c35f9e1d..da84f544c544 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -608,7 +608,8 @@ static int regcache_sync_block_single(struct regmap *map, void *block,
 	for (i = start; i < end; i++) {
 		regtmp = block_base + (i * map->reg_stride);
 
-		if (!regcache_reg_present(cache_present, i))
+		if (!regcache_reg_present(cache_present, i) ||
+		    !regmap_writeable(map, regtmp))
 			continue;
 
 		val = regcache_get_val(map, block, i);
@@ -677,7 +678,8 @@ static int regcache_sync_block_raw(struct regmap *map, void *block,
 	for (i = start; i < end; i++) {
 		regtmp = block_base + (i * map->reg_stride);
 
-		if (!regcache_reg_present(cache_present, i)) {
+		if (!regcache_reg_present(cache_present, i) ||
+		    !regmap_writeable(map, regtmp)) {
 			ret = regcache_sync_block_raw_flush(map, &data,
 							    base, regtmp);
 			if (ret != 0)
-- 
2.3.1


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

* Re: [PATCH v2] regmap: Skip read-only registers in regcache_sync()
  2015-03-04 14:29 [PATCH v2] regmap: Skip read-only registers in regcache_sync() Takashi Iwai
@ 2015-03-04 17:09 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2015-03-04 17:09 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: linux-kernel

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

On Wed, Mar 04, 2015 at 03:29:17PM +0100, Takashi Iwai wrote:
> 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 adds regmap_wrtieable() checks for
> avoiding it in regcache_sync_block_single() and regcache_block_raw().

Applied, thanks!

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

end of thread, other threads:[~2015-03-04 17:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-04 14:29 [PATCH v2] regmap: Skip read-only registers in regcache_sync() Takashi Iwai
2015-03-04 17:09 ` Mark Brown

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.