Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 13753a90 authored by Dimitris Papastamos's avatar Dimitris Papastamos Committed by Mark Brown
Browse files

regmap: Lock the sync path, ensure we use the lockless _regmap_write()

parent 5fcd2560
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ static int regcache_indexed_sync(struct regmap *map)
	int ret;

	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);
		if (ret < 0)
			return ret;
+1 −1
Original line number Diff line number Diff line
@@ -339,7 +339,7 @@ static int regcache_lzo_sync(struct regmap *map)
		if (ret)
			return ret;
		map->cache_bypass = 1;
		ret = regmap_write(map, i, val);
		ret = _regmap_write(map, i, val);
		map->cache_bypass = 0;
		if (ret)
			return ret;
+1 −1
Original line number Diff line number Diff line
@@ -327,7 +327,7 @@ static int regcache_rbtree_sync(struct regmap *map)
			if (val == def)
				continue;
			map->cache_bypass = 1;
			ret = regmap_write(map, regtmp, val);
			ret = _regmap_write(map, regtmp, val);
			map->cache_bypass = 0;
			if (ret)
				return ret;
+3 −1
Original line number Diff line number Diff line
@@ -230,6 +230,7 @@ int regcache_sync(struct regmap *map)

	BUG_ON(!map->cache_ops);

	mutex_lock(&map->lock);
	dev_dbg(map->dev, "Syncing %s cache\n",
		map->cache_ops->name);
	name = map->cache_ops->name;
@@ -242,7 +243,7 @@ int regcache_sync(struct regmap *map)
			if (ret < 0)
				goto out;
			map->cache_bypass = 1;
			ret = regmap_write(map, i, val);
			ret = _regmap_write(map, i, val);
			map->cache_bypass = 0;
			if (ret < 0)
				goto out;
@@ -254,6 +255,7 @@ int regcache_sync(struct regmap *map)
	}
out:
	trace_regcache_sync(map->dev, name, "stop");
	mutex_unlock(&map->lock);

	return ret;
}