* [PATCH] regcache: Always make cache_present big enough for max_register
@ 2013-05-06 15:06 Mark Brown
0 siblings, 0 replies; only message in thread
From: Mark Brown @ 2013-05-06 15:06 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-kernel, Mark Brown
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2013-05-06 15:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-06 15:06 [PATCH] regcache: Always make cache_present big enough for max_register Mark Brown
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®