summaryrefslogtreecommitdiffstats
path: root/drivers/base/regmap
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2013-08-31 20:25:13 +0200
committerMark Brown <broonie@linaro.org>2013-08-31 20:25:13 +0200
commit3dedb61ec7a62ba669d07c604ebfa28598b569f2 (patch)
treeba7032a969555d34b456537e8bfc8d28e48e6f6a /drivers/base/regmap
parentMerge remote-tracking branch 'regmap/topic/irq' into regmap-next (diff)
parentregmap: Allow multiple patches to be registered (diff)
downloadlinux-3dedb61ec7a62ba669d07c604ebfa28598b569f2.tar.xz
linux-3dedb61ec7a62ba669d07c604ebfa28598b569f2.zip
Merge remote-tracking branch 'regmap/topic/patch' into regmap-next
Diffstat (limited to 'drivers/base/regmap')
-rw-r--r--drivers/base/regmap/regmap.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 0e85367e504d..ff58f3847c06 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1891,13 +1891,10 @@ EXPORT_SYMBOL_GPL(regmap_async_complete);
int regmap_register_patch(struct regmap *map, const struct reg_default *regs,
int num_regs)
{
+ struct reg_default *p;
int i, ret;
bool bypass;
- /* If needed the implementation can be extended to support this */
- if (map->patch)
- return -EBUSY;
-
map->lock(map->lock_arg);
bypass = map->cache_bypass;
@@ -1914,11 +1911,13 @@ int regmap_register_patch(struct regmap *map, const struct reg_default *regs,
}
}
- map->patch = kcalloc(num_regs, sizeof(struct reg_default), GFP_KERNEL);
- if (map->patch != NULL) {
- memcpy(map->patch, regs,
- num_regs * sizeof(struct reg_default));
- map->patch_regs = num_regs;
+ p = krealloc(map->patch,
+ sizeof(struct reg_default) * (map->patch_regs + num_regs),
+ GFP_KERNEL);
+ if (p) {
+ memcpy(p + map->patch_regs, regs, num_regs * sizeof(*regs));
+ map->patch = p;
+ map->patch_regs += num_regs;
} else {
ret = -ENOMEM;
}