[PATCH v1 2/3] regmap: Use BITS_TO_BYTES()

Andy Shevchenko posted 3 patches 2 days, 19 hours ago
[PATCH v1 2/3] regmap: Use BITS_TO_BYTES()
Posted by Andy Shevchenko 2 days, 19 hours ago
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>
---
 drivers/base/regmap/regmap.c | 7 +++----
 1 file 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;
-- 
2.43.0.rc1.1336.g36b5255a03ac