regmap: Save/restore the bypass state upon syncing
authorDimitris Papastamos <dp@opensource.wolfsonmicro.com>
Thu, 29 Sep 2011 13:36:26 +0000 (14:36 +0100)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Fri, 30 Sep 2011 12:57:47 +0000 (13:57 +0100)
Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/base/regmap/regcache.c

index 59e432c0163d30a9771c4aeefd00f4c4e5e07c0c..5dbc5076267e995b006b594a9c64675ae361e2ef 100644 (file)
@@ -227,10 +227,13 @@ int regcache_sync(struct regmap *map)
        unsigned int val;
        unsigned int i;
        const char *name;
+       unsigned int bypass;
 
        BUG_ON(!map->cache_ops);
 
        mutex_lock(&map->lock);
+       /* Remember the initial bypass state */
+       bypass = map->cache_bypass;
        dev_dbg(map->dev, "Syncing %s cache\n",
                map->cache_ops->name);
        name = map->cache_ops->name;
@@ -255,6 +258,8 @@ int regcache_sync(struct regmap *map)
        }
 out:
        trace_regcache_sync(map->dev, name, "stop");
+       /* Restore the bypass state */
+       map->cache_bypass = bypass;
        mutex_unlock(&map->lock);
 
        return ret;