aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/regmap/regcache.c
diff options
context:
space:
mode:
authorJarkko Nikula <jarkko.nikula@linux.intel.com>2014-09-16 07:04:14 -0400
committerMark Brown <broonie@kernel.org>2014-09-16 12:53:40 -0400
commitf29a43206ae1adfadbb344f5ef9bc200784f9d61 (patch)
tree4bac109bdbad260dd324a4d70cff6214a3c8cd0b /drivers/base/regmap/regcache.c
parent7d1311b93e58ed55f3a31cc8f94c4b8fe988a2b9 (diff)
regmap: cache: Do not fail silently from regcache_sync calls
Call stack of regcache_sync calls may not emit any error message even if operation was cancelled due an error in I/O driver. One such a silent error is for instance if I2C bus driver doesn't receive ACK from the I2C device and returns -EREMOTEIO. Since many users of regcache_sync() don't check and print the error there is no any indication that HW registers are potentially out of sync. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/base/regmap/regcache.c')
-rw-r--r--drivers/base/regmap/regcache.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index 29b4128da0b0..da7b3bfd4d7f 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -269,8 +269,11 @@ static int regcache_default_sync(struct regmap *map, unsigned int min,
269 map->cache_bypass = 1; 269 map->cache_bypass = 1;
270 ret = _regmap_write(map, reg, val); 270 ret = _regmap_write(map, reg, val);
271 map->cache_bypass = 0; 271 map->cache_bypass = 0;
272 if (ret) 272 if (ret) {
273 dev_err(map->dev, "Unable to sync register %#x. %d\n",
274 reg, ret);
273 return ret; 275 return ret;
276 }
274 dev_dbg(map->dev, "Synced register %#x, value %#x\n", reg, val); 277 dev_dbg(map->dev, "Synced register %#x, value %#x\n", reg, val);
275 } 278 }
276 279
@@ -615,8 +618,11 @@ static int regcache_sync_block_single(struct regmap *map, void *block,
615 ret = _regmap_write(map, regtmp, val); 618 ret = _regmap_write(map, regtmp, val);
616 619
617 map->cache_bypass = 0; 620 map->cache_bypass = 0;
618 if (ret != 0) 621 if (ret != 0) {
622 dev_err(map->dev, "Unable to sync register %#x. %d\n",
623 regtmp, ret);
619 return ret; 624 return ret;
625 }
620 dev_dbg(map->dev, "Synced register %#x, value %#x\n", 626 dev_dbg(map->dev, "Synced register %#x, value %#x\n",
621 regtmp, val); 627 regtmp, val);
622 } 628 }
@@ -641,6 +647,9 @@ static int regcache_sync_block_raw_flush(struct regmap *map, const void **data,
641 map->cache_bypass = 1; 647 map->cache_bypass = 1;
642 648
643 ret = _regmap_raw_write(map, base, *data, count * val_bytes); 649 ret = _regmap_raw_write(map, base, *data, count * val_bytes);
650 if (ret)
651 dev_err(map->dev, "Unable to sync registers %#x-%#x. %d\n",
652 base, cur - map->reg_stride, ret);
644 653
645 map->cache_bypass = 0; 654 map->cache_bypass = 0;
646 655