Commit fc3ebd78 authored by Krystian Garbaciak's avatar Krystian Garbaciak Committed by Mark Brown

regmap: Move lock out from internal function _regmap_update_bits().

Locks are moved to regmap_update_bits(), which allows to reenter internal
function _regmap_update_bits() from inside of regmap read/write routines.
Signed-off-by: default avatarKrystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 485802a6
...@@ -982,11 +982,9 @@ static int _regmap_update_bits(struct regmap *map, unsigned int reg, ...@@ -982,11 +982,9 @@ static int _regmap_update_bits(struct regmap *map, unsigned int reg,
int ret; int ret;
unsigned int tmp, orig; unsigned int tmp, orig;
map->lock(map);
ret = _regmap_read(map, reg, &orig); ret = _regmap_read(map, reg, &orig);
if (ret != 0) if (ret != 0)
goto out; return ret;
tmp = orig & ~mask; tmp = orig & ~mask;
tmp |= val & mask; tmp |= val & mask;
...@@ -998,9 +996,6 @@ static int _regmap_update_bits(struct regmap *map, unsigned int reg, ...@@ -998,9 +996,6 @@ static int _regmap_update_bits(struct regmap *map, unsigned int reg,
*change = false; *change = false;
} }
out:
map->unlock(map);
return ret; return ret;
} }
...@@ -1018,7 +1013,13 @@ int regmap_update_bits(struct regmap *map, unsigned int reg, ...@@ -1018,7 +1013,13 @@ int regmap_update_bits(struct regmap *map, unsigned int reg,
unsigned int mask, unsigned int val) unsigned int mask, unsigned int val)
{ {
bool change; bool change;
return _regmap_update_bits(map, reg, mask, val, &change); int ret;
map->lock(map);
ret = _regmap_update_bits(map, reg, mask, val, &change);
map->unlock(map);
return ret;
} }
EXPORT_SYMBOL_GPL(regmap_update_bits); EXPORT_SYMBOL_GPL(regmap_update_bits);
...@@ -1038,7 +1039,12 @@ int regmap_update_bits_check(struct regmap *map, unsigned int reg, ...@@ -1038,7 +1039,12 @@ int regmap_update_bits_check(struct regmap *map, unsigned int reg,
unsigned int mask, unsigned int val, unsigned int mask, unsigned int val,
bool *change) bool *change)
{ {
return _regmap_update_bits(map, reg, mask, val, change); int ret;
map->lock(map);
ret = _regmap_update_bits(map, reg, mask, val, change);
map->unlock(map);
return ret;
} }
EXPORT_SYMBOL_GPL(regmap_update_bits_check); EXPORT_SYMBOL_GPL(regmap_update_bits_check);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment