]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge remote-tracking branch 'regmap/topic/range' into regmap-next
authorMark Brown <broonie@linaro.org>
Sat, 31 Aug 2013 18:25:14 +0000 (19:25 +0100)
committerMark Brown <broonie@linaro.org>
Sat, 31 Aug 2013 18:25:14 +0000 (19:25 +0100)
1  2 
drivers/base/regmap/regmap.c

index ff58f3847c06474a58e8aa7e3f36a938d7d870e1,436fac05b3b619511017781358b39031acade35f..aaf4e1372980a07951946bf252cfd3bda7438c9e
@@@ -687,6 -687,10 +687,10 @@@ skip_format_initialization
                        unsigned win_max = win_min +
                                           config->ranges[j].window_len - 1;
  
+                       /* Allow data window inside its own virtual range */
+                       if (j == i)
+                               continue;
                        if (range_cfg->range_min <= sel_reg &&
                            sel_reg <= range_cfg->range_max) {
                                dev_err(map->dev,
@@@ -1261,9 -1265,6 +1265,9 @@@ int _regmap_write(struct regmap *map, u
        int ret;
        void *context = _regmap_map_get_context(map);
  
 +      if (!regmap_writeable(map, reg))
 +              return -EIO;
 +
        if (!map->cache_bypass && !map->defer_caching) {
                ret = regcache_write(map, reg, val);
                if (ret != 0)
@@@ -1891,10 -1892,13 +1895,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;
                }
        }
  
 -      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;
        }