lkml.org 
[lkml]   [2011]   [Nov]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 5/7] regmap: Check if a register is writable instead of readable in regcache_read
Date
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@metafoo.de>
---
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



\
 
 \ /
  Last update: 2011-11-16 16:31    [W:0.128 / U:0.336 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site