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

index aaf4e1372980a07951946bf252cfd3bda7438c9e,bf8a81c930acb2406192efd40942612b85de5f85..7d689a15c500bb34ddc3331f33b57512890341aa
@@@ -303,6 -303,7 +303,7 @@@ static void regmap_unlock_mutex(void *_
  }
  
  static void regmap_lock_spinlock(void *__map)
+ __acquires(&map->spinlock)
  {
        struct regmap *map = __map;
        unsigned long flags;
  }
  
  static void regmap_unlock_spinlock(void *__map)
+ __releases(&map->spinlock)
  {
        struct regmap *map = __map;
        spin_unlock_irqrestore(&map->spinlock, map->spinlock_flags);
@@@ -687,10 -689,6 +689,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,
@@@ -1265,9 -1263,6 +1267,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)
@@@ -1860,7 -1855,7 +1862,7 @@@ int regmap_async_complete(struct regma
        int ret;
  
        /* Nothing to do with no async support */
 -      if (!map->bus->async_write)
 +      if (!map->bus || !map->bus->async_write)
                return 0;
  
        trace_regmap_async_complete_start(map->dev);
@@@ -1895,10 -1890,13 +1897,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;
        }