summaryrefslogtreecommitdiffstats
path: root/drivers/base/regmap
diff options
context:
space:
mode:
authorCharles Keepax <ckeepax@opensource.wolfsonmicro.com>2014-02-25 13:45:51 +0000
committerMark Brown <broonie@linaro.org>2014-02-26 08:58:40 +0900
commit6bf13103b2dbf09d32a0da2e732b6196522c1462 (patch)
tree10b521983e32581ca592cba7e1ba62e2b8d97408 /drivers/base/regmap
parent1d5b40bccf04994248b39e8ce234a7c1f3235cf5 (diff)
downloadlinux-6bf13103b2dbf09d32a0da2e732b6196522c1462.tar.bz2
regmap: Base regmap_register_patch on _regmap_multi_reg_write
Since we now have an internal version of regmap_multi_reg_write use this to apply the register patch. Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/base/regmap')
-rw-r--r--drivers/base/regmap/regmap.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index e6a2c29c0be4..35ab7baffcc5 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -2227,7 +2227,7 @@ int regmap_register_patch(struct regmap *map, const struct reg_default *regs,
int num_regs)
{
struct reg_default *p;
- int i, ret;
+ int ret;
bool bypass;
if (WARN_ONCE(num_regs <= 0, "invalid registers number (%d)\n",
@@ -2241,19 +2241,9 @@ int regmap_register_patch(struct regmap *map, const struct reg_default *regs,
map->cache_bypass = true;
map->async = true;
- /* Write out first; it's useful to apply even if we fail later. */
- for (i = 0; i < num_regs; i++) {
- if (regs[i].reg % map->reg_stride) {
- ret = -EINVAL;
- goto out;
- }
- ret = _regmap_write(map, regs[i].reg, regs[i].def);
- if (ret != 0) {
- dev_err(map->dev, "Failed to write %x = %x: %d\n",
- regs[i].reg, regs[i].def, ret);
- goto out;
- }
- }
+ ret = _regmap_multi_reg_write(map, regs, num_regs);
+ if (ret != 0)
+ goto out;
p = krealloc(map->patch,
sizeof(struct reg_default) * (map->patch_regs + num_regs),