summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorKrystian Garbaciak <krystian.garbaciak@diasemi.com>2012-06-15 11:23:56 +0100
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-06-17 21:30:39 +0100
commitfc3ebd788e894b4dd6c9524cb3874eeeb1e862d6 (patch)
treef8e15faaaa7d5a689149ddcc5965dba684140d2b /drivers
parent485802a6c524e62b5924849dd727ddbb1497cc71 (diff)
downloadlinux-3.10-fc3ebd788e894b4dd6c9524cb3874eeeb1e862d6.tar.gz
linux-3.10-fc3ebd788e894b4dd6c9524cb3874eeeb1e862d6.tar.bz2
linux-3.10-fc3ebd788e894b4dd6c9524cb3874eeeb1e862d6.zip
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: Krystian Garbaciak <krystian.garbaciak@diasemi.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/base/regmap/regmap.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index c89aa01fb1d..652017991da 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -982,11 +982,9 @@ static int _regmap_update_bits(struct regmap *map, unsigned int reg,
int ret;
unsigned int tmp, orig;
- map->lock(map);
-
ret = _regmap_read(map, reg, &orig);
if (ret != 0)
- goto out;
+ return ret;
tmp = orig & ~mask;
tmp |= val & mask;
@@ -998,9 +996,6 @@ static int _regmap_update_bits(struct regmap *map, unsigned int reg,
*change = false;
}
-out:
- map->unlock(map);
-
return ret;
}
@@ -1018,7 +1013,13 @@ int regmap_update_bits(struct regmap *map, unsigned int reg,
unsigned int mask, unsigned int val)
{
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);
@@ -1038,7 +1039,12 @@ int regmap_update_bits_check(struct regmap *map, unsigned int reg,
unsigned int mask, unsigned int val,
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);