mirror of
https://github.com/fail0verflow/switch-linux.git
synced 2025-05-04 02:34:21 -04:00
regmap: Lock the sync path, ensure we use the lockless _regmap_write()
Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
parent
5fcd256076
commit
13753a9088
4 changed files with 7 additions and 5 deletions
|
@ -45,8 +45,8 @@ static int regcache_indexed_sync(struct regmap *map)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
for (i = 0; i < map->num_reg_defaults; i++) {
|
for (i = 0; i < map->num_reg_defaults; i++) {
|
||||||
ret = regmap_write(map, map->reg_defaults[i].reg,
|
ret = _regmap_write(map, map->reg_defaults[i].reg,
|
||||||
map->reg_defaults[i].def);
|
map->reg_defaults[i].def);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
dev_dbg(map->dev, "Synced register %#x, value %#x\n",
|
dev_dbg(map->dev, "Synced register %#x, value %#x\n",
|
||||||
|
|
|
@ -339,7 +339,7 @@ static int regcache_lzo_sync(struct regmap *map)
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
map->cache_bypass = 1;
|
map->cache_bypass = 1;
|
||||||
ret = regmap_write(map, i, val);
|
ret = _regmap_write(map, i, val);
|
||||||
map->cache_bypass = 0;
|
map->cache_bypass = 0;
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -327,7 +327,7 @@ static int regcache_rbtree_sync(struct regmap *map)
|
||||||
if (val == def)
|
if (val == def)
|
||||||
continue;
|
continue;
|
||||||
map->cache_bypass = 1;
|
map->cache_bypass = 1;
|
||||||
ret = regmap_write(map, regtmp, val);
|
ret = _regmap_write(map, regtmp, val);
|
||||||
map->cache_bypass = 0;
|
map->cache_bypass = 0;
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -230,6 +230,7 @@ int regcache_sync(struct regmap *map)
|
||||||
|
|
||||||
BUG_ON(!map->cache_ops);
|
BUG_ON(!map->cache_ops);
|
||||||
|
|
||||||
|
mutex_lock(&map->lock);
|
||||||
dev_dbg(map->dev, "Syncing %s cache\n",
|
dev_dbg(map->dev, "Syncing %s cache\n",
|
||||||
map->cache_ops->name);
|
map->cache_ops->name);
|
||||||
name = map->cache_ops->name;
|
name = map->cache_ops->name;
|
||||||
|
@ -242,7 +243,7 @@ int regcache_sync(struct regmap *map)
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto out;
|
goto out;
|
||||||
map->cache_bypass = 1;
|
map->cache_bypass = 1;
|
||||||
ret = regmap_write(map, i, val);
|
ret = _regmap_write(map, i, val);
|
||||||
map->cache_bypass = 0;
|
map->cache_bypass = 0;
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -254,6 +255,7 @@ int regcache_sync(struct regmap *map)
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
trace_regcache_sync(map->dev, name, "stop");
|
trace_regcache_sync(map->dev, name, "stop");
|
||||||
|
mutex_unlock(&map->lock);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue