regmap: cache: cleanup regcache_hw_init()
authorXiubo Li <Li.Xiubo@freescale.com>
Thu, 9 Oct 2014 09:02:53 +0000 (17:02 +0800)
committerMark Brown <broonie@kernel.org>
Mon, 20 Oct 2014 11:25:01 +0000 (12:25 +0100)
Remove the redundant code for regmap cache.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/base/regmap/regcache.c

index f1280dc356d095dee65ccaa47d29652bd97b38dc..7558e6b01c0495b217737a7a89ef652dd7c49740 100644 (file)
@@ -57,12 +57,9 @@ static int regcache_hw_init(struct regmap *map)
        }
 
        /* calculate the size of reg_defaults */
-       for (count = 0, i = 0; i < map->num_reg_defaults_raw; i++) {
-               val = regcache_get_val(map, map->reg_defaults_raw, i);
-               if (regmap_volatile(map, i * map->reg_stride))
-                       continue;
-               count++;
-       }
+       for (count = 0, i = 0; i < map->num_reg_defaults_raw; i++)
+               if (!regmap_volatile(map, i * map->reg_stride))
+                       count++;
 
        map->reg_defaults = kmalloc(count * sizeof(struct reg_default),
                                      GFP_KERNEL);