summaryrefslogtreecommitdiffstats
path: root/drivers/base/regmap
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2013-08-31 20:25:11 +0200
committerMark Brown <broonie@linaro.org>2013-08-31 20:25:11 +0200
commit4ff4eb9e8c535f67ad2c1adc6c168ece1fb763bc (patch)
tree34a9a67dc8d427959e649cebbab9bee7ddef2d1b /drivers/base/regmap
parentregmap: debugfs: Fix continued read from registers file (diff)
parentregmap: regcache: allow read-only regs to be cached (diff)
downloadlinux-4ff4eb9e8c535f67ad2c1adc6c168ece1fb763bc.tar.xz
linux-4ff4eb9e8c535f67ad2c1adc6c168ece1fb763bc.zip
Merge remote-tracking branch 'regmap/topic/cache' into regmap-next
Diffstat (limited to 'drivers/base/regmap')
-rw-r--r--drivers/base/regmap/internal.h2
-rw-r--r--drivers/base/regmap/regcache.c3
-rw-r--r--drivers/base/regmap/regmap.c3
3 files changed, 4 insertions, 4 deletions
diff --git a/drivers/base/regmap/internal.h b/drivers/base/regmap/internal.h
index 29c83160ca29..5308e3e870ba 100644
--- a/drivers/base/regmap/internal.h
+++ b/drivers/base/regmap/internal.h
@@ -223,7 +223,7 @@ int regcache_set_reg_present(struct regmap *map, unsigned int reg);
static inline bool regcache_reg_present(struct regmap *map, unsigned int reg)
{
if (!map->cache_present)
- return true;
+ return false;
if (reg > map->cache_present_nbits)
return false;
return map->cache_present[BIT_WORD(reg)] & BIT_MASK(reg);
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index 3455f833e473..e2abd0548e7b 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -241,9 +241,6 @@ int regcache_write(struct regmap *map,
BUG_ON(!map->cache_ops);
- if (!regmap_writeable(map, reg))
- return -EIO;
-
if (!regmap_volatile(map, reg))
return map->cache_ops->write(map, reg, value);
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index e0d0c7d8a5c5..0e85367e504d 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1261,6 +1261,9 @@ int _regmap_write(struct regmap *map, unsigned int reg,
int ret;
void *context = _regmap_map_get_context(map);
+ if (!regmap_writeable(map, reg))
+ return -EIO;
+
if (!map->cache_bypass && !map->defer_caching) {
ret = regcache_write(map, reg, val);
if (ret != 0)