num_regs))
return 0;
--- --- map->lock(map->lock_arg);
--- ---
--- --- bypass = map->cache_bypass;
--- ---
--- --- 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++) {
--- --- 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;
--- --- }
--- --- }
--- ---
+ 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;
+++ ++++ return -ENOMEM;
+ }
+
+++ +++ map->lock(map->lock_arg);
+++ +++
+++ +++ bypass = map->cache_bypass;
+++ +++
+++ +++ 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++) {
- 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),
- 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;
- }
-
out:
map->async = false;
map->cache_bypass = bypass;