1
0
Fork 0

Merge remote-tracking branch 'regmap/topic/patch' into regmap-next

hifive-unleashed-5.1
Mark Brown 2013-08-31 19:25:13 +01:00
commit 3dedb61ec7
1 changed files with 8 additions and 9 deletions

View File

@ -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;
}