aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorKrystian Garbaciak <krystian.garbaciak@diasemi.com>2012-06-15 06:23:56 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-06-17 16:30:39 -0400
commitfc3ebd788e894b4dd6c9524cb3874eeeb1e862d6 (patch)
treef8e15faaaa7d5a689149ddcc5965dba684140d2b /drivers/base
parent485802a6c524e62b5924849dd727ddbb1497cc71 (diff)
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/base')
-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 c89aa01fb1de..652017991da6 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,
982 int ret; 982 int ret;
983 unsigned int tmp, orig; 983 unsigned int tmp, orig;
984 984
985 map->lock(map);
986
987 ret = _regmap_read(map, reg, &orig); 985 ret = _regmap_read(map, reg, &orig);
988 if (ret != 0) 986 if (ret != 0)
989 goto out; 987 return ret;
990 988
991 tmp = orig & ~mask; 989 tmp = orig & ~mask;
992 tmp |= val & mask; 990 tmp |= val & mask;
@@ -998,9 +996,6 @@ static int _regmap_update_bits(struct regmap *map, unsigned int reg,
998 *change = false; 996 *change = false;
999 } 997 }
1000 998
1001out:
1002 map->unlock(map);
1003
1004 return ret; 999 return ret;
1005} 1000}
1006 1001
@@ -1018,7 +1013,13 @@ int regmap_update_bits(struct regmap *map, unsigned int reg,
1018 unsigned int mask, unsigned int val) 1013 unsigned int mask, unsigned int val)
1019{ 1014{
1020 bool change; 1015 bool change;
1021 return _regmap_update_bits(map, reg, mask, val, &change); 1016 int ret;
1017
1018 map->lock(map);
1019 ret = _regmap_update_bits(map, reg, mask, val, &change);
1020 map->unlock(map);
1021
1022 return ret;
1022} 1023}
1023EXPORT_SYMBOL_GPL(regmap_update_bits); 1024EXPORT_SYMBOL_GPL(regmap_update_bits);
1024 1025
@@ -1038,7 +1039,12 @@ int regmap_update_bits_check(struct regmap *map, unsigned int reg,
1038 unsigned int mask, unsigned int val, 1039 unsigned int mask, unsigned int val,
1039 bool *change) 1040 bool *change)
1040{ 1041{
1041 return _regmap_update_bits(map, reg, mask, val, change); 1042 int ret;
1043
1044 map->lock(map);
1045 ret = _regmap_update_bits(map, reg, mask, val, change);
1046 map->unlock(map);
1047 return ret;
1042} 1048}
1043EXPORT_SYMBOL_GPL(regmap_update_bits_check); 1049EXPORT_SYMBOL_GPL(regmap_update_bits_check);
1044 1050