summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2024-11-21 12:57:22 +0200
committerMark Brown <broonie@kernel.org>2024-12-02 00:30:59 +0000
commita4a7d86bc1a59839ad0dffbefa473135b342dd0b (patch)
treefa42630ba3db99d525be825563ea01c036ef9d3a
parent4a3aafe01f6c628932a402c21e58101173c8dab3 (diff)
regmap: 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-3-andriy.shevchenko@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--drivers/base/regmap/regmap.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 53131a7ede0a..d2944271022c 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -759,12 +759,11 @@ struct regmap *__regmap_init(struct device *dev,
map->reg_base = config->reg_base;
- map->format.reg_bytes = DIV_ROUND_UP(config->reg_bits, 8);
+ map->format.reg_bytes = BITS_TO_BYTES(config->reg_bits);
map->format.pad_bytes = config->pad_bits / 8;
map->format.reg_shift = config->reg_shift;
- map->format.val_bytes = DIV_ROUND_UP(config->val_bits, 8);
- map->format.buf_size = DIV_ROUND_UP(config->reg_bits +
- config->val_bits + config->pad_bits, 8);
+ map->format.val_bytes = BITS_TO_BYTES(config->val_bits);
+ map->format.buf_size = BITS_TO_BYTES(config->reg_bits + config->val_bits + config->pad_bits);
map->reg_shift = config->pad_bits % 8;
if (config->reg_stride)
map->reg_stride = config->reg_stride;