[lkml]   [2011]   [Nov]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 5/7] regmap: Check if a register is writable instead of readable in regcache_read
On 11/16/2011 05:16 PM, Mark Brown wrote:
> On Wed, Nov 16, 2011 at 04:28:20PM +0100, Lars-Peter Clausen wrote:
>> 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.
> This logic doesn't entirely follow - one can have registers which are
> volatile but could be read once at startup. Plus...

Hm? The use case here is chips which do not support readback. So we never
want to fallback to a hardware read but still want to be able to do a cached

>> @@ -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;
> ...the code winds up just looking like an obvious bug.

Why? If a register is not writable we won't have anything in the cache for
it. So reading from the cache for a register which is not writable doesn't
make any sense.

 \ /
  Last update: 2011-11-16 17:37    [W:0.106 / U:4.148 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site