Skip to content

Commit 4a3aafe

Browse files
andy-shevbroonie
authored andcommitted
regmap: cache: Use BITS_TO_BYTES()
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>
1 parent 40384c8 commit 4a3aafe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/base/regmap/regcache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ int regcache_init(struct regmap *map, const struct regmap_config *config)
154154
map->num_reg_defaults = config->num_reg_defaults;
155155
map->num_reg_defaults_raw = config->num_reg_defaults_raw;
156156
map->reg_defaults_raw = config->reg_defaults_raw;
157-
map->cache_word_size = DIV_ROUND_UP(config->val_bits, 8);
157+
map->cache_word_size = BITS_TO_BYTES(config->val_bits);
158158
map->cache_size_raw = map->cache_word_size * config->num_reg_defaults_raw;
159159

160160
map->cache = NULL;

0 commit comments

Comments
 (0)