From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Mark Brown <broonie@kernel.org>
Cc: linux-kernel@vger.kernel.org,
Mark Brown <broonie@opensource.wolfsonmicro.com>
Subject: [PATCH] regcache: Always make cache_present big enough for max_register
Date: Mon, 6 May 2013 16:06:08 +0100 [thread overview]
Message-ID: <1367852768-31389-1-git-send-email-broonie@opensource.wolfsonmicro.com> (raw)
There is no point in continually reallocating the cache_present bitmap
when we know how big it could possibly be.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
drivers/base/regmap/regcache.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index 8a0ab5f..14c6eef 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -463,6 +463,9 @@ int regcache_set_reg_present(struct regmap *map, unsigned int reg)
int i;
nregs = reg + 1;
+ if (nregs < map->max_register + 1)
+ nregs = map->max_register + 1;
+
cache_present_size = BITS_TO_LONGS(nregs);
cache_present_size *= sizeof(long);
--
1.7.10.4
reply other threads:[~2013-05-06 15:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1367852768-31389-1-git-send-email-broonie@opensource.wolfsonmicro.com \
--to=broonie@opensource.wolfsonmicro.com \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®