From: Joe Perches <joe@perches.com>
To: Fabio Estevam <festevam@gmail.com>
Cc: broonie@opensource.wolfsonmicro.com, gregkh@linuxfoundation.org,
marc@cpdesign.com.au, philippe.retornaz@epfl.ch,
linux-kernel@vger.kernel.org,
Fabio Estevam <fabio.estevam@freescale.com>
Subject: Re: [PATCH] regmap: Fix the size calculation for map->format.buf_size
Date: Thu, 31 May 2012 17:17:35 -0700 [thread overview]
Message-ID: <1338509855.9151.2.camel@joe2Laptop> (raw)
In-Reply-To: <1338509430-24416-1-git-send-email-festevam@gmail.com>
On Thu, 2012-05-31 at 21:10 -0300, Fabio Estevam wrote:
> the total size should be calculated by summing up the number of bits of
> each element and using a DIV_ROUND_UP to return the number of bytes.
[]
> diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
[]
> @@ -246,11 +246,11 @@ struct regmap *regmap_init(struct device *dev,
> map->lock = regmap_lock_mutex;
> map->unlock = regmap_unlock_mutex;
> }
> - map->format.buf_size = (config->reg_bits + config->val_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 = DIV_ROUND_UP(config->val_bits, 8);
> - map->format.buf_size += map->format.pad_bytes;
> + map->format.buf_size = DIV_ROUND_UP(config->reg_bits +
> + config->val_bits + config->pad_bits, 8);
> map->reg_shift = config->pad_bits % 8;
s/8/BITS_PER_BYTE/ ?
next prev parent reply other threads:[~2012-06-01 0:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-01 0:10 Fabio Estevam
2012-06-01 0:17 ` Joe Perches [this message]
2012-06-01 1:07 ` [PATCH v2] " Fabio Estevam
2012-06-03 12:28 ` [PATCH] " Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1338509855.9151.2.camel@joe2Laptop \
--to=joe@perches.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=fabio.estevam@freescale.com \
--cc=festevam@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marc@cpdesign.com.au \
--cc=philippe.retornaz@epfl.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome