Merge remote-tracking branch 'regmap/for-next'
authorStephen Rothwell <sfr@canb.auug.org.au>
Tue, 13 Sep 2016 00:59:17 +0000 (10:59 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 13 Sep 2016 00:59:17 +0000 (10:59 +1000)
drivers/base/regmap/internal.h
drivers/base/regmap/regmap-debugfs.c
drivers/base/regmap/regmap.c

index a0380338946a1dbd6cb7e54ab70b001edc77eef7..f4be4c19bb170b652b996e8537abc31dc40f3597 100644 (file)
@@ -173,6 +173,7 @@ struct regcache_ops {
        int (*drop)(struct regmap *map, unsigned int min, unsigned int max);
 };
 
+bool regmap_cached(struct regmap *map, unsigned int reg);
 bool regmap_writeable(struct regmap *map, unsigned int reg);
 bool regmap_readable(struct regmap *map, unsigned int reg);
 bool regmap_volatile(struct regmap *map, unsigned int reg);
index 1ee3d40861c7ee77b819e9ae0118fb5f774bb215..36ce3511c733f62193a32fe3b63fd4d195209092 100644 (file)
@@ -77,6 +77,17 @@ static void regmap_debugfs_free_dump_cache(struct regmap *map)
        }
 }
 
+static bool regmap_printable(struct regmap *map, unsigned int reg)
+{
+       if (regmap_precious(map, reg))
+               return false;
+
+       if (!regmap_readable(map, reg) && !regmap_cached(map, reg))
+               return false;
+
+       return true;
+}
+
 /*
  * Work out where the start offset maps into register numbers, bearing
  * in mind that we suppress hidden registers.
@@ -105,8 +116,7 @@ static unsigned int regmap_debugfs_get_dump_start(struct regmap *map,
        if (list_empty(&map->debugfs_off_cache)) {
                for (; i <= map->max_register; i += map->reg_stride) {
                        /* Skip unprinted registers, closing off cache entry */
-                       if (!regmap_readable(map, i) ||
-                           regmap_precious(map, i)) {
+                       if (!regmap_printable(map, i)) {
                                if (c) {
                                        c->max = p - 1;
                                        c->max_reg = i - map->reg_stride;
@@ -204,7 +214,7 @@ static ssize_t regmap_read_debugfs(struct regmap *map, unsigned int from,
        start_reg = regmap_debugfs_get_dump_start(map, from, *ppos, &p);
 
        for (i = start_reg; i <= to; i += map->reg_stride) {
-               if (!regmap_readable(map, i))
+               if (!regmap_readable(map, i) && !regmap_cached(map, i))
                        continue;
 
                if (regmap_precious(map, i))
index 25d26bb18970694d808a3d679e613a5487fa8236..369a4c3c933e04873b9dfef2b7783027fd25d60c 100644 (file)
@@ -93,6 +93,29 @@ bool regmap_writeable(struct regmap *map, unsigned int reg)
        return true;
 }
 
+bool regmap_cached(struct regmap *map, unsigned int reg)
+{
+       int ret;
+       unsigned int val;
+
+       if (map->cache == REGCACHE_NONE)
+               return false;
+
+       if (!map->cache_ops)
+               return false;
+
+       if (map->max_register && reg > map->max_register)
+               return false;
+
+       map->lock(map->lock_arg);
+       ret = regcache_read(map, reg, &val);
+       map->unlock(map->lock_arg);
+       if (ret)
+               return false;
+
+       return true;
+}
+
 bool regmap_readable(struct regmap *map, unsigned int reg)
 {
        if (!map->reg_read)
This page took 0.028195 seconds and 5 git commands to generate.