]> git.karo-electronics.de Git - linux-beck.git/commitdiff
regmap: Properly round reg_bytes and val_bytes
authorWolfram Sang <w.sang@pengutronix.de>
Sat, 28 Jan 2012 01:16:41 +0000 (02:16 +0100)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Sun, 29 Jan 2012 21:42:40 +0000 (21:42 +0000)
For the upcoming 2/6-format, we don't see debugfs output otherwise,
since the current division results in 0. I'd think 10/14 is broken
currently, too.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/base/regmap/regmap.c

index b4475d87f4a0e8c64061913b8a6a57ca95a00547..3c34526091da9d54b60845ce3ba9be8e7b1ec10a 100644 (file)
@@ -167,9 +167,9 @@ struct regmap *regmap_init(struct device *dev,
 
        mutex_init(&map->lock);
        map->format.buf_size = (config->reg_bits + config->val_bits) / 8;
-       map->format.reg_bytes = config->reg_bits / 8;
+       map->format.reg_bytes = DIV_ROUND_UP(config->reg_bits, 8);
        map->format.pad_bytes = config->pad_bits / 8;
-       map->format.val_bytes = config->val_bits / 8;
+       map->format.val_bytes = DIV_ROUND_UP(config->val_bits, 8);
        map->format.buf_size += map->format.pad_bytes;
        map->dev = dev;
        map->bus = bus;