[PATCH 5/7] regmap: Check if a register is writable instead of readable in regcache_read

From: Lars-Peter Clausen
Date: Wed Nov 16 2011 - 10:28:12 EST


One of the reasons for using a cache is to have a software shadow of a register
which is writable but not readable. This allows us to do a read-modify-write
operation on such a register.

Currently regcache checks whether a register is readable when performing a
cached read and returns an error if not. Change this check to test whether the
register is writable. This makes more sense, since reading from the cache when
the register is not readable allows the operation described above, but if the
register is not writable there shouldn't be a value for it in the cache anyway.

Signed-off-by: Lars-Peter Clausen <lars@xxxxxxxxxx>
---
drivers/base/regmap/regcache.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index 6f0dbc0..a004a7a 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -206,7 +206,7 @@ int regcache_read(struct regmap *map,

BUG_ON(!map->cache_ops);

- if (!regmap_readable(map, reg))
+ if (!regmap_writeable(map, reg))
return -EIO;

if (!regmap_volatile(map, reg))
--
1.7.7.1


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/