lkml.org 
[lkml]   [2011]   [Sep]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 6/6 v3] regmap: Incorporate the regcache core into regmap
> [...]
> @@ -321,6 +333,18 @@ int regmap_write(struct regmap *map, unsigned int reg, unsigned int val)
>
> mutex_lock(&map->lock);
>
> + if (!map->cache_bypass) {
> + ret = regcache_write(map, reg, val);
> + if (ret < 0) {
> + mutex_unlock(&map->lock);
> + return ret;
> + }
> + if (map->cache_only) {
> + mutex_unlock(&map->lock);
> + return 0;
> + }
> + }
> +

Would it make sense to move this into _regmap_write ? In that case the code
wouldn't have to be duplicated in regmap_update_bits and as a bonus it wouldn't
have to deal with the mutex either.

> ret = _regmap_write(map, reg, val);
>
> mutex_unlock(&map->lock);
> @@ -422,6 +446,14 @@ int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val)
>
> mutex_lock(&map->lock);
>
> + if (!map->cache_bypass) {
> + ret = regcache_read(map, reg, val);
> + if (!ret) {
> + mutex_unlock(&map->lock);
> + return 0;
> + }

So in case regmap_readable is not true for this register regcache_read will
return -EIO and we'll fallback to an uncached read. This doesn't make sense in
my opinion. Or what are the except semantics regmap_readable supposed to be?

> + }
> +
> ret = _regmap_read(map, reg, val);
>
> mutex_unlock(&map->lock);



\
 
 \ /
  Last update: 2011-09-15 17:21    [W:0.069 / U:0.696 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site