]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
regmap: cache: Use BITS_TO_BYTES()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 21 Nov 2024 10:57:21 +0000 (12:57 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 2 Dec 2024 00:30:58 +0000 (00:30 +0000)
BITS_TO_BYTES() is the existing macro which takes care about full
bytes that may fully hold the given amount of bits. Use it.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20241121105838.4073659-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/base/regmap/regcache.c

index d3659ba3cc1122f55c53c1acd568010cb4d78f4d..b1f8508c3966df54fe5514d00aa1fdeb392967c4 100644 (file)
@@ -154,7 +154,7 @@ int regcache_init(struct regmap *map, const struct regmap_config *config)
        map->num_reg_defaults = config->num_reg_defaults;
        map->num_reg_defaults_raw = config->num_reg_defaults_raw;
        map->reg_defaults_raw = config->reg_defaults_raw;
-       map->cache_word_size = DIV_ROUND_UP(config->val_bits, 8);
+       map->cache_word_size = BITS_TO_BYTES(config->val_bits);
        map->cache_size_raw = map->cache_word_size * config->num_reg_defaults_raw;
 
        map->cache = NULL;